angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Optimization (uglify-es) breaks codemirror linting

Open jmesa-sistel opened this issue 8 years ago • 5 comments

Bug Report or Feature Request (mark with an x)

- [X] bug report -> please search issues before submitting
- [ ] feature request

Command (mark with an x)

- [ ] new
- [X] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Versions

npm --version 5.6.0

ng --version Angular CLI: 6.2.2 Node: 8.11.4 OS: win32 x64 Angular: 6.1.7 ... animations, common, compiler, compiler-cli, core, forms ... http, language-service, platform-browser ... platform-browser-dynamic, router, service-worker

Package Version

@angular-devkit/architect 0.8.2 @angular-devkit/build-angular 0.8.2 @angular-devkit/build-optimizer 0.8.2 @angular-devkit/build-webpack 0.8.2 @angular-devkit/core 0.8.2 @angular-devkit/schematics 0.8.2 @angular/cli 6.2.2 @angular/pwa 0.8.2 @ngtools/webpack 6.2.2 @schematics/angular 0.8.2 @schematics/update 0.8.2 rxjs 6.3.2 typescript 2.9.2 webpack 4.19.0

Repro steps

Not easy to reproduce. The problem is when optimization is true, then uglify-es breaks codemirror linting. The solution is apply this commit 907fedc from master to 6.x.x branch. Or update uglifyjs-webpack-plugin to 2.0.0

The log given by the failure

from console log: main.d54661d3d921c6ccca26.js:1 ERROR ReferenceError: b is not defined at s (4.f196ba946a81605dfd12.js:1) at 4.f196ba946a81605dfd12.js:1 at Wi (4.f196ba946a81605dfd12.js:1) at yl.operation (4.f196ba946a81605dfd12.js:1) at a (4.f196ba946a81605dfd12.js:1) at yl.performLint (4.f196ba946a81605dfd12.js:1) at t._next (4.f196ba946a81605dfd12.js:1) at t.__tryOrUnsub (main.d54661d3d921c6ccca26.js:1) at t.next (main.d54661d3d921c6ccca26.js:1) at t._next (main.d54661d3d921c6ccca26.js:1)

Mention any other details that might be useful

Moving to terser-webpack-plugin or update uglifyjs-webpack-plugin to 2.0.0 (they have move to uglify-js in 2.0.0) fix the issue

jmesa-sistel avatar Sep 17 '18 11:09 jmesa-sistel

I am going to close this, as the issue has been already solved in CLI 7 and there is no plan to implement terser on the 6.2.x branch.

alan-agius4 avatar Sep 18 '18 07:09 alan-agius4

@alan-agius4 Then are you going to update uglifyjs-webpack-plugin to 2.0.0 in 6.2.x branch ?

rodries avatar Sep 18 '18 07:09 rodries

@alan-agius4 @hansl Why are anybody not replying to my question?. To fix 6.2.x branch you only need to update uglifyjs-webpack-plugin to 2.0.0. Any problem with this fix?

rodries avatar Sep 27 '18 09:09 rodries

@alan-agius4 As rodries has said, is there any problem upgrading uglifyjs-webpack-plugin to 2.0.0? This will fix strange problems on production.
uglifyjs-webpack-plugin has move from uglify-es to uglify-js due a lot of problems with optimizations

jmesa-sistel avatar Sep 27 '18 09:09 jmesa-sistel

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.