angular-builder-custom-terser-options
angular-builder-custom-terser-options copied to clipboard
Support for Angular 8
In Angular 8, there were some changes in the builder API and it's no longer compatible with the new version besides package.json version requirements.
Error:
Could not find the implementation for builder angular-builder-custom-terser-options:browser-custom-terser
Error: Could not find the implementation for builder angular-builder-custom-terser-options:browser-custom-terser
at WorkspaceNodeModulesArchitectHost.resolveBuilder (/Users/foo/bar/node_modules/@angular-devkit/architect/node/node-modules-architect-host.js:49:19)
...
👍 I've upvoted to bring terser customization into angular's default builder, as this I'm finding this builder really useful for my project where I want to see which component is performing the logging. So I agree that support for angular 8 would be a good enhancement to implement soon. I'll take a look to see whether I can submit a PR to help this along 😄
Hello @keenondrums - do you have an idea of when the Angular 8 support will be released? Would like test this, our project was recently upgraded to Angular 8 and the constructor.name is required. Thanks!
Is it as simple as creating a PR with peerDependencies tweaked as follows?
"peerDependencies": {
"@angular-devkit/build-angular": ">= ^0.13.2",
"@angular/compiler-cli": ">= ^7.2.5",
"@angular/compiler": ">= ^7.2.5",
"@angular/core": ">= ^7.2.5",
"terser-webpack-plugin": "^1.2.2"
}
If so, I can do that pretty easily?
If the fix is in master, and you look at the recent commits, I doubt those are the only changes. Not too sure though
@JAspeling, yes you are absolutely right, I didn't notice the latest commit which indeed contains more changes.
Guys, the fix is indeed in master, but I didn't have time to test it. As soon as I do, I'll make it an official release.
Just a heads up - I compiled the code using npm run prepack and copied the dist folder into the package in my node_modules, and it's still giving the same error. Not sure if that's the right way of using the master branch though.
It seems it was complaining about the implementation being missing because node-modules-architect-host.js is looking for the implementation property on the builder which doesnt exist. Added that, the build on my angular 8 project succeeds.
However the issue seems to still persist.
Upvoting! Since ng 8.2.4+ there is an issue with Terser and tinymce on a unicode regex, the only workaround is to set ascii_only: true using your builder.
I published 2.0.0-alpha.0. It works if es5 differential loading is disabled. Unfortunately, I don't have time to make it work as it seems to require re-writing too much code. My bud reported this set of builders works well. Try it instead of this one. Another way to go around the issue is to monkey-patch minify from Terser.
Hi @aigoncharov can you please give as some repo example how to use angular-builders to keep class names?
@yantrab which version of Angular are you using?
Angular 8
We are actually migrating our current codebase to be minify-friendly so it doesn't depend on relaxed terser options. That's the other option people have and actually should go for.
Thanks for the plugin, but we are no longer using it :)