father
father copied to clipboard
mac系统father build babel模式下生成没有文件出来
Build cjs with babel Clean lib directory Build esm with babel Clean es directory
如何复现?
有可能是文件没有匹配上
const babelTransformRegexp = disableTypeCheck ? /\.(t|j)sx?$/ : /\.jsx?$/;
disableTypeCheck
设置为false
只匹配jsx?
文件. 要设置为true
才能都匹配.
没看懂这里为什么要这样做.
启用类型检查的情况下,gulp-ts 会预先把 tsx 编译为 jsx
我也遇见这个问题了
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 文件
@PeachScript
我用的是dumi 里自带的 father-build
请提供最小可复现仓库
https://gitee.com/uixepm/dumi.git @PeachScript 可改变.fatherrc.ts中disableTypeCheck的值分别打包yarn build 我的机器是
有大佬解答下困惑吗
father 4 已发布,可尝试升级到最新版:https://github.com/umijs/father/blob/master/docs/guide/migrate.md
旧版本不再维护,感谢支持