reactjs - 带有 microbundle-crl 的 React Typescript 不会为主文件以外的文件创建 js 文件

标签 reactjs typescript

我的文件夹结构是

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/

相关文章:

reactjs - 在 react-leaflet 中呈现超过 1000 个标记需要很长时间,用户体验很糟糕,需要改进我的方法

javascript - 在我的 react 应用程序中获取对象中数组的所有图像

javascript - 如何在 JavaScript 中创建动态 json 对象

angular - 无法读取未定义错误的属性 'navigate'

angular - 为什么必须提供angular2组件构造函数参数

javascript - 如果连续点击两个相同的名字,如何使两个相同的名字保持红色?

javascript - 如何防止 Redux 转换不可变数据(使用 Transit.fromJSON 时)?

reactjs - 当我尝试推送我的应用程序时,heroku 不断给我这个错误

visual-studio - 找不到 TypeScript 编译器

pdf - html2canvas 使用 angular2/typescript 使用 css 样式呈现文档 PDF