father icon indicating copy to clipboard operation
father copied to clipboard

mac系统father build babel模式下生成没有文件出来

Open gao525280067 opened this issue 4 years ago • 9 comments

Build cjs with babel Clean lib directory Build esm with babel Clean es directory

gao525280067 avatar Apr 04 '20 10:04 gao525280067

如何复现?

PeachScript avatar Apr 06 '20 15:04 PeachScript

有可能是文件没有匹配上

  const babelTransformRegexp = disableTypeCheck ? /\.(t|j)sx?$/ : /\.jsx?$/;

disableTypeCheck设置为false只匹配jsx?文件. 要设置为true才能都匹配. 没看懂这里为什么要这样做.

7kms avatar May 26 '20 14:05 7kms

启用类型检查的情况下,gulp-ts 会预先把 tsx 编译为 jsx

PeachScript avatar Sep 27 '20 05:09 PeachScript

我也遇见这个问题了

export default {
  cjs: {
    type: 'babel',
    minify: true,
    lazy: true,
  },
  esm: 'babel',
  extraExternals: [
    'react',
    'react-dom',
    /^@babel\/runtime/,
  ],
  extraBabelPlugins: [
    [
      'import',
      {
        libraryName: 'antd',
        libraryDirectory: 'es',
        style: 'css',
      },
    ],
  ],
  disableTypeCheck: true,
  runtimeHelpers: true,
}

当disableTypeCheck 为false 时不会将 src下ts文件打包到es lib 下的相应文件下;为true 就会出现js 文件 image

jiaolongshenme avatar Jun 30 '21 02:06 jiaolongshenme

@PeachScript

jiaolongshenme avatar Jun 30 '21 02:06 jiaolongshenme

我用的是dumi 里自带的 father-build

jiaolongshenme avatar Jun 30 '21 02:06 jiaolongshenme

请提供最小可复现仓库

PeachScript avatar Jun 30 '21 03:06 PeachScript

https://gitee.com/uixepm/dumi.git @PeachScript 可改变.fatherrc.ts中disableTypeCheck的值分别打包yarn build 我的机器是 image

jiaolongshenme avatar Jun 30 '21 06:06 jiaolongshenme

有大佬解答下困惑吗

jiaolongshenme avatar Jul 01 '21 12:07 jiaolongshenme

father 4 已发布,可尝试升级到最新版:https://github.com/umijs/father/blob/master/docs/guide/migrate.md

旧版本不再维护,感谢支持

PeachScript avatar Aug 31 '22 11:08 PeachScript