我的文件夹结构是
src/lib/componentA.tsx
src/index.tsx
使用 microbundle-crl
运行构建后我得到关注dist/lib/componentA.d.ts /* problem is that no js file is created at this path*/
dist/index.js
我在期待 dist/lib/componentA.js
文件也是,但它永远不会被创建,所有的逻辑都连接在一个我不想要的 index.js 中。我的 tsconfig 如下:
{
"compilerOptions": {
"outDir": "dist",
"module": "esnext",
"lib": ["dom", "esnext"],
"moduleResolution": "node",
"jsx": "react",
"sourceMap": true,
"declaration": true,
"esModuleInterop": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noImplicitAny": true,
"strictNullChecks": true,
"suppressImplicitAnyIndexErrors": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"allowSyntheticDefaultImports": true
},
"include": ["src"],
"exclude": ["node_modules", "dist", "example"]
}
任何帮助表示赞赏
最佳答案
请注意,正在运行的笑话会修改您的 tsconfig.js
文件。
我不得不手动覆盖 "allowJs": false
让我的类型定义正常工作。可能是类似的东西。
关于reactjs - 带有 microbundle-crl 的 React Typescript 不会为主文件以外的文件创建 js 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62825646/