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

latest babel 7.7.0 is causing babel-plugin-minify-simplify to fail #968

Open
jchip opened this issue Nov 6, 2019 · 1 comment
Open

latest babel 7.7.0 is causing babel-plugin-minify-simplify to fail #968

jchip opened this issue Nov 6, 2019 · 1 comment

Comments

@jchip
Copy link

jchip commented Nov 6, 2019

Describe the bug

After updating to the babel modules version 7.7.0 published on 11/05/19, babel-plugin-minify-simplify/lib/index.js:549:40 is now failing with Cannot set property inList of [object Object] which has only a getter.

This is pulled in by babel-preset-minify 0.4.3. It's used to minify React code.

To Reproduce

Minimal code to reproduce the bug
package.json

{
  "name": "m1",
  "dependencies": {
    "@babel/cli": "^7.7.0",
    "@babel/core": "^7.7.0",
    "@babel/preset-env": "^7.7.1",
    "@babel/preset-react": "^7.7.0",
    "babel-preset-minify": "^0.5.1"
  }
}

.babelrc.js:

module.exports = {
  presets: [["@babel/env", { modules: "auto" }], "@babel/react", "minify"].filter(x => x)
};

test.js

function test(b) {
  if (b.foo) {
    return b.foo;
  }
}

command: npx babel test.js

Actual Output

Error thrown

Expected Output

No error thrown

Stack Trace

{ TypeError: ./test.js: Cannot set property inList of [object Object] which has only a getter
    at PluginPass.exit (./node_modules/babel-plugin-minify-simplify/lib/index.js:549:40)
    at newFn (./node_modules/@babel/traverse/lib/visitors.js:179:21)
    at NodePath._call (./node_modules/@babel/traverse/lib/path/context.js:55:20)
    at NodePath.call (./node_modules/@babel/traverse/lib/path/context.js:42:17)
    at NodePath.visit (./node_modules/@babel/traverse/lib/path/context.js:99:8)
    at TraversalContext.visitQueue (./node_modules/@babel/traverse/lib/context.js:112:16)
    at TraversalContext.visitSingle (./node_modules/@babel/traverse/lib/context.js:84:19)
    at TraversalContext.visit (./node_modules/@babel/traverse/lib/context.js:140:19)
    at Function.traverse.node (./node_modules/@babel/traverse/lib/index.js:84:17)
    at NodePath.visit (./node_modules/@babel/traverse/lib/path/context.js:97:18) code: 'BABEL_TRANSFORM_ERROR' }

Configuration

How are you using babel-minify?

babel-minify CLI

babel-minify version: 0.4.3

babel version : @babel/[email protected]

babel-minify-config:

{
  removeConsole: true,
  keepFnNames: true
}

babelrc:

{
  plugins: [],
  presets: []
}

Possible solution

Additional context

@jchip
Copy link
Author

jchip commented Nov 6, 2019

oops, already reported #967

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

1 participant