sorrycc / roadhog

🐷 Cli tool for creating react apps, configurable version of create-react-app.
2.72k stars 342 forks source link

构建报UglifyJs错误 #890

Open icanplayinsky opened 2 years ago

icanplayinsky commented 2 years ago

Environment(required) | 环境(必填)

What did you do? Please provide steps to re-produce your problem.(请提供复现步骤)

npm run build:dev的时候报错误:Failed to minify the bundle. Error: index.60e242d9.js from UglifyJs Unexpected token operator «=», expected punc «,» [index.60e242d9.js:586539,48] 经查询是crypto-js包没有编译成es5,导致UglifyJs压缩js时报错。 在webpackrc.js中引入了extraBabelIncludes,但是没有效果 export default { entry: 'src/index.js', extraBabelPlugins: [['import', { libraryName: 'antd', libraryDirectory: 'es', style: true }]], extraBabelIncludes:['./node_modules/crypto-js'], env: { development: { extraBabelPlugins: ['dva-hmr'], }, },

What do you expected?(预期的正常效果)

在在webpackrc.js中引入了extraBabelIncludes应该要正常编译该crypto-js包

What happen?(发生了何种非正常现象)

npm run build:dev的时候报错误:Failed to minify the bundle. Error: index.60e242d9.js from UglifyJs Unexpected token operator «=», expected punc «,» [index.60e242d9.js:586539,48]

Re-producible online demo (可复现的在线demo)

1