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

babelrc node target version 7 is too high #1

Open
taranchauhan opened this issue Aug 2, 2018 · 2 comments
Open

babelrc node target version 7 is too high #1

taranchauhan opened this issue Aug 2, 2018 · 2 comments

Comments

@taranchauhan
Copy link

taranchauhan commented Aug 2, 2018

babelrc node target 7 is too high and this causes the UglifyJS plugin in my webpack production config to fail as it can't parse the syntax in lib/index.js during my webpack -p --config webpack.prod.config.js to fail.

This is due to class syntax, default params and pick.js line 2 [prop] punctuation all not being transpiled correctly in manage-state.

There are a few possible workarounds:

  1. Remove the node target completely in .babelrc
  2. Set uglify property to true See targets.uglify
  3. Set node target to sensible version before classes, default params and other unsupported UglifyJS features in manage-state.

Both of these .babelrc configs work.

Solution 1:

{
  "presets": [
    "env",
    "stage-1",
    "react"
  ]
}

Solution 2

{
  "presets": [
    ["env", {
       "targets": {
         "node": 7,
         "uglify": true
       }
    }],
    "stage-1",
    "react"
  ]
}
@taranchauhan taranchauhan changed the title manage-state babelrc node target 7 causes babel compilation babelrc node target version 7 is too high Aug 2, 2018
@penx
Copy link
Owner

penx commented Aug 2, 2018

Or use uglifyjs 2/3?

@penx
Copy link
Owner

penx commented Aug 2, 2018

Also please refer to this

sindresorhus/ama#446

Not saying I agree with everything written, just worth considering when deciding what to do here

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