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

Production build breaks browsers which doesn't support PropertyShorthend #1211

Closed
pudek357 opened this issue Jan 24, 2018 · 3 comments
Closed

Comments

@pudek357
Copy link

Hi everyone 👋

This PR introduced problem with production build, when we use in code PropertyShorthend.

I was trying to investigate this problem and I figured out that the problem is with this line.
If ecma is set to >= 6 then UglifyJS produces for example code:

const someVar = 'abc';
const testObj = {
  someVar,
};

that production build:

const testObj = {  someVar };

but should instead:

const testObj = {  someVar: someVar  };
@gauravtiwari
Copy link
Member

@pudek357 You could tweak your babelrc with appropriate browser query: http://browserl.ist/?q=%3E%3D+1%25 (this is what we ship with atm)

You could set specific browsers you need to support in your query: https://github.com/ai/browserslist#queries

@pudek357
Copy link
Author

pudek357 commented Jan 24, 2018

it's mine .babelrc:

{
  "presets": [
    [
      "env",
      {
        "modules": false,
        "targets": {
          "browsers": [
            "last 2 versions",
            "> 1%",
            "ie > 10"
          ],
          "uglify": true
        },
        "useBuiltIns": true
      }
    ],
    "react"
  ],
  "plugins": [
    "syntax-dynamic-import",
    "transform-object-rest-spread",
    [
      "transform-class-properties",
      {
        "spec": true
      }
    ]
  ]
}

It's work with "@rails/webpacker": "3.2.0" when i change version to 3.2.1 then it doesn't uglify properly PropertyShorthend.

Additionally when you change here ecma value to 5 then it will work good, so I think problem is with UglifyJs with was added in 3.2.1

@gauravtiwari
Copy link
Member

Please try the latest RC, otherwise feel free to open a new issue with more details.

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