father
father copied to clipboard
dumi中使用构建father-build遇到问题
Question
我在global.d.ts声明了一个全局变量(比如 TESTVAR )。然后使用father build构建项目,通过extraRollupPlugins字段引用了rollup-plugin-typescript2插件,指向的是在tsconfig.dist.json配置进行编译,tsconfig.dist.json extends了tsconfig.json,只有exclude不同。 平时开发、在eslint和tsc里都没有任何报错。 所以按理说father build也不应该报错吧? 但是father-build出来,说没有找到TESTVAR。这个是怎么回事,怎么解决呢。
开发时:
father-build时的报错:
Sample Code
复现Repo: https://github.com/milobluebell/mlz-admin/tree/aStableVersion [aStableVersion分支]
复现方式:
$ sudo npm install
$
$ npm run lint && sudo npm run dist
TY.
father 内部已经有 typescript2 插件了,重新制定的 tsconfig.json 可能不会生效:https://github.com/umijs/father/blob/master/packages/father-build/src/getRollupConfig.ts#L190
辛苦!但是感觉貌似不是这个导致的哦。因为就算使用的是father-build里的rollup-plugin-typescript2
,也应该读的是 tsconfig.json ,那应该也没问题呀。
除非连tsconfig.json都读错了?也不太像,那天在群里问过你。你说是lerna的pkg最重,然后就是根目录。这样其实是对的,也符合理解。
@sorrycc 大佬麻烦给看下吧,多谢了。
father 4 已发布,可尝试升级到最新版:https://github.com/umijs/father/blob/master/docs/guide/migrate.md
旧版本不再维护,感谢支持