Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

构建报UglifyJs错误 #890

Open
icanplayinsky opened this issue Nov 16, 2021 · 4 comments
Open

构建报UglifyJs错误 #890

icanplayinsky opened this issue Nov 16, 2021 · 4 comments

Comments

@icanplayinsky
Copy link

Environment(required) | 环境(必填)

  • roadhog version(roadhog版本)2.5.0-beta.4
  • Nodejs and Npm version(Nodejs 和 Npm 版本)Nodejs:v14.17.3 npm:6.14.13
  • Operating environment (e.g. OS name) and its version(操作系统版本): macos big sur

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

@sunny-pandora
Copy link

sunny-pandora commented Nov 22, 2021

I have the same issue here, I wanted to use TypeScript to some part of my project that made with Javascript/React. It went well on the local environment, but when I build them with Roadhog, it cause some problem like this.

I wish there were more information for English as well. My service had built like 3 years ago and grew up as a big service. it is really hard to migrate or update with some new service because RoadHog seems like stoped updating.

Please Give some help on it.

@jumpingFinger
Copy link

同错误,3年半以前pro v1 项目,2年前从roadhog版本从2.4.(也是编译错误) 升级到 2.5.0-beta.4 ,老项目过大,升级v4,时间跟改造成本太高,纠结中,

@ZeroJian
Copy link

ZeroJian commented Jan 9, 2022

同错误

@smithyj
Copy link

smithyj commented Aug 17, 2022

可以看下是哪个库有es6语法,然后再extraBabelIncludes里面增加配置,例如下面的

{
  extraBabelIncludes: [
    'node_modules/antd-mobile',
    'node_modules/@react-spring',
  ],
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants