bowser
bowser copied to clipboard
Extra comma breaks the production build in angular cli app
See: https://github.com/lancedikson/bowser/blob/2.6.0/src/parser.js#L454 There is an extra comma on the line end.
The library is used in Angular 7 cli project. The production build with
ng build --prod
fails with an error:
Unexpected token: punc ())
Removing the extra comma fixes the error.
The issue is very similar to: https://stackoverflow.com/questions/54380816/unexpected-token-punc-when-building-for-production
@milen-yordanov, must be fixed with the 2.6.1 release, please check it out :)
The issue is still present in 2.6.1 See: https://github.com/lancedikson/bowser/blob/2.6.1/src/parser.js#L454 The extra comma on the line end is still there.
Ok, I was expecting that angular would take a ES5 version of bowser, since 2.6.1 introduces the "browser" property, which points to es5.js. Anyway, I will take a look at the codestyle again or maybe will fix the bundling so, that it would include a standard ES2015 code, which doesn't break any linters. But, you mentioned production only. Does it work in dev mode?
The extra comma breaks the optimized webpack build. Yes, it breaks only the production build. The dev build does not include optimize+uglify+minify and it works
.
I just tried 2.6.1 and the the prod build succeeded. But it could be just a coincidence. Version 2.5.4 works fine and version 2.6.0 breaks the build and all these have that extra comma.
Anyway I suggest that comma to be removed.
This also breaks compiling with google closure compiler