father icon indicating copy to clipboard operation
father copied to clipboard

dumi中使用构建father-build遇到问题

Open milobluebell opened this issue 4 years ago • 4 comments

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。这个是怎么回事,怎么解决呢。

开发时: image

father-build时的报错: image

Sample Code

复现Repo: https://github.com/milobluebell/mlz-admin/tree/aStableVersion [aStableVersion分支]

复现方式:

$ sudo npm install 
$ 
$ npm run lint && sudo npm run dist

TY.

milobluebell avatar Dec 16 '20 10:12 milobluebell

father 内部已经有 typescript2 插件了,重新制定的 tsconfig.json 可能不会生效:https://github.com/umijs/father/blob/master/packages/father-build/src/getRollupConfig.ts#L190

PeachScript avatar Dec 16 '20 14:12 PeachScript

辛苦!但是感觉貌似不是这个导致的哦。因为就算使用的是father-build里的rollup-plugin-typescript2,也应该读的是 tsconfig.json ,那应该也没问题呀。

milobluebell avatar Dec 16 '20 15:12 milobluebell

除非连tsconfig.json都读错了?也不太像,那天在群里问过你。你说是lerna的pkg最重,然后就是根目录。这样其实是对的,也符合理解。

milobluebell avatar Dec 16 '20 15:12 milobluebell

@sorrycc 大佬麻烦给看下吧,多谢了。

milobluebell avatar Dec 17 '20 03:12 milobluebell

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

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

PeachScript avatar Aug 31 '22 11:08 PeachScript