Skip to content
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

Issue with Edge not respecting TerserOptions #62

Closed
LuisAverhoff opened this issue Jan 18, 2019 · 1 comment
Closed

Issue with Edge not respecting TerserOptions #62

LuisAverhoff opened this issue Jan 18, 2019 · 1 comment

Comments

@LuisAverhoff
Copy link

LuisAverhoff commented Jan 18, 2019

I have a piece of code that relies on function.prototype.name like so

public typeIs<TNewType>(newTypeAssertion: new (...args: any[]) => TNewType) {
    this.stringValue = `TypeIs:${newTypeAssertion.name}`
    this.segmentType = 'typeIs'
    return this.finialize<TNewType>()
  }

Initially my terser options didn't set keep_fnames to true and that caused my web application in both chrome and edge to not function properly. Now it looks like this.

minimizer: [
        new TerserPlugin({
          cache: true,
          parallel: true,
          terserOptions: {
            keep_fnames: true // This is so that the typeIs function works in production.
          }
        })
      ],

And now the function name does not get mangle in chrome but still somehow gets mangled in edge even with keep_fnames set to true. I did find a solution by doing this

minimizer: [
        new TerserPlugin({
          cache: true,
          parallel: true,
          terserOptions: {
            keep_fnames: true // This is so that the typeIs function works in production.
            compress: false // Now newTypeAssertion.name does not get mangled in edge as well.
          }
        })
      ],

But I don't want to do that because my bundle would increase quite a bit. Any clue as to why edge still mangles the function name and why setting compress to false works?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants