-
Notifications
You must be signed in to change notification settings - Fork 12k
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
@webcomponents/custom-element and UglifyJs ng build --prod error #7509
Comments
es2015+ libraries are currently not supported by the UglifyJS version being used. The UglifyJS plugin required is currently in beta (https://github.com/webpack-contrib/uglifyjs-webpack-plugin). |
Thank you @clydin for the swift response. Does this mean there is no way currently to get it to work out of the box and I'll need to |
With your current method, yes. However, using the scripts configuration option in
|
Thank you @clydin you're a hero! I got it to work thus:
|
Thanks and no problem. |
Hi - I think this issue should be reopened until the UglifyJS version used supports ES6. Otherwise, is there another issue we should be tracking? This continues to break the loading of Web Component polyfills within polyfill.ts. The following should work but does not with no currently known workaround:
|
The 1.5 beta has support for es2015+ build output. To enable, adjust the tsconfig to target es2015. Note that the build will no longer work in older browsers. Also, there should be es5 versions of the scripts in question that can be used via the app's scripts config option. I provided an example in an above comment. |
@clydin thanks, the issue ended up being on my side. It looks another alternative here though would be to Transpiling |
The eject and uglifyjs change will build but you'll end up with a mix of es2015 and es5 code. If you're uncomfortable using the beta (which is understandable), another option is to copy the scripts in question into the assets folder and include them directly with a script tag in the app's index.html. |
I'm getting /webcomponents-lite.js.map" Error (404): "Not found" "@angular/cli": "^1.4.0" angular-cli.json |
Our project at work is stuck at angular/cli
|
Update: upgraded to Angular |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Bug Report or Feature Request (mark with an
x
)Versions.
Repro steps.
Please clone this repository: https://github.com/whyboris/uglifyerror
(It contains only 2 additional lines of code (https://github.com/whyboris/uglifyerror/commit/db6d327e8a2477431828f4d2e209071864f54664) on top of a clean
ng new uglifyerror
project)Run
ng build --prod
The log given by the failure.
I asked UglifyJs and was told it's an Angular problem: mishoo/UglifyJS#2287
Desired functionality.
The package needs to build without error. Any solution is welcome.
Mention any other details that might be useful.
The only changes necessary to replicate the error are:
https://github.com/whyboris/uglifyerror/commit/db6d327e8a2477431828f4d2e209071864f54664
Adding:
"@webcomponents/custom-elements": "1.0.0",
topackage.json
andimport '@webcomponents/custom-elements/src/native-shim';
insrc/polyfills.ts
I have attempted this solution: #5741 (comment)
(using
"uglify-js": "git://github.com/mishoo/UglifyJS2.git#harmony",
and removing&reinstalling node_modules) with no successThe text was updated successfully, but these errors were encountered: