egg icon indicating copy to clipboard operation
egg copied to clipboard

egg-bin --require babel-register has error with file .umirc.local.js

Open yanxlg opened this issue 7 years ago • 4 comments

What happens?

A clear and concise description of what the bug is. when use egg-bin to run dev with option '--require babel-register',the console show an error: E:\workspace\create-umi\a1\app\web\.umirc.local.js:3 export default { ^^^^^^

SyntaxError: Unexpected token 'export' at Module._compile (internal/modules/cjs/loader.js:881:18) at Module._compile (E:\workspace\create-umi\a1\node_modules\pirates\lib\index.js:97:24) at Module._extensions..js (internal/modules/cjs/loader.js:962:10) at Object.newLoader [as .js] (E:\workspace\create-umi\a1\node_modules\pirates\lib\index.js:102:7) at Module.load (internal/modules/cjs/loader.js:798:32) at Function.Module._load (internal/modules/cjs/loader.js:711:12) at Module.require (internal/modules/cjs/loader.js:838:19) at require (internal/modules/cjs/helpers.js:74:18) at requireFile (E:\workspace\create-umi\a1\node_modules\umi-core\lib\getUserConfig.js:106:11) at getConfigByConfigFile (E:\workspace\create-umi\a1\node_modules\umi-core\lib\getUserConfig.js:127:148) � Starting Umi UI using [email protected]...

It seems that file '.umirc.local.js' did not compile with babel.so how to deal with it.

yanxlg avatar Nov 12 '19 10:11 yanxlg

it seems the error is thrown by umi-core, maybe you should report the issue to them.

atian25 avatar Nov 12 '19 11:11 atian25

It's not umi-core's error,because if not use ssr,it is powerful,only use egg with ssr, it throw this error,it seems that egg-bin can not support babel perfectly.

yanxlg avatar Nov 13 '19 01:11 yanxlg

Hello @yanxlg. Please provide a reproducible example following the instruction.

Issues labeled by Need Reproduce will be closed if no activities in 7 days.


@yanxlg,请根据这个说明提供最小可复现代码。

如果在 7 天内没有进展会被自动关闭。

egg-bot avatar Nov 13 '19 02:11 egg-bot

egg doesn't provide an official umi egg plugin.

egg-bin --require is just add it to execArgv, if you fork umi without append the argv, it'll not pass to umi.

atian25 avatar Nov 13 '19 02:11 atian25