angular-builder-custom-terser-options icon indicating copy to clipboard operation
angular-builder-custom-terser-options copied to clipboard

Support for Angular 8

Open sebastianhaeni opened this issue 6 years ago • 14 comments

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)
...

sebastianhaeni avatar May 29 '19 16:05 sebastianhaeni

👍 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 😄

nbarrett avatar Jul 19 '19 18:07 nbarrett

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!

JAspeling avatar Sep 01 '19 21:09 JAspeling

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?

nbarrett avatar Sep 01 '19 22:09 nbarrett

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 avatar Sep 01 '19 22:09 JAspeling

@JAspeling, yes you are absolutely right, I didn't notice the latest commit which indeed contains more changes.

nbarrett avatar Sep 01 '19 22:09 nbarrett

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.

fxlrnrpt avatar Sep 02 '19 06:09 fxlrnrpt

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.

JAspeling avatar Sep 02 '19 13:09 JAspeling

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.

JAspeling avatar Sep 02 '19 13:09 JAspeling

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.

P3tronius avatar Sep 13 '19 08:09 P3tronius

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.

fxlrnrpt avatar Sep 21 '19 11:09 fxlrnrpt

Hi @aigoncharov can you please give as some repo example how to use angular-builders to keep class names?

yantrab avatar Oct 29 '19 18:10 yantrab

@yantrab which version of Angular are you using?

fxlrnrpt avatar Oct 29 '19 19:10 fxlrnrpt

Angular 8

yantrab avatar Oct 29 '19 19:10 yantrab

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 :)

sebastianhaeni avatar Nov 03 '19 17:11 sebastianhaeni