4Catalyzer / babel-plugin-dev-expression

A mirror of Facebook's dev-expression Babel plugin
MIT License
184 stars 6 forks source link

Add this plugin throw a TypeError #2

Closed chentsulin closed 8 years ago

chentsulin commented 8 years ago

Try to add this plugin into .babelrc but throw a TypeError, and everything works normally after removed it.

/Users/chentsulin/Projects/electron-react-boilerplate/node_modules/babel-core/lib/transformation/file/index.js:591
      throw err;
      ^

TypeError: /Users/chentsulin/Projects/electron-react-boilerplate/webpack.config.production.js: Property key of ObjectProperty expected node to be of a type ["Identifier","StringLiteral","NumericLiteral"] but instead got "BinaryExpression"
    at validate (/Users/chentsulin/Projects/electron-react-boilerplate/node_modules/babel-types/lib/definitions/index.js:109:13)
    at Object.validate (/Users/chentsulin/Projects/electron-react-boilerplate/node_modules/babel-types/lib/definitions/core.js:507:63)
    at Object.validate (/Users/chentsulin/Projects/electron-react-boilerplate/node_modules/babel-types/lib/index.js:541:9)
    at NodePath._replaceWith (/Users/chentsulin/Projects/electron-react-boilerplate/node_modules/babel-traverse/lib/path/replacement.js:214:7)

More detail Info: PR: https://github.com/chentsulin/electron-react-boilerplate/pull/238/files Travis Build: https://travis-ci.org/chentsulin/electron-react-boilerplate/jobs/135365374

taion commented 8 years ago

It's because of https://github.com/chentsulin/electron-react-boilerplate/blob/6698a036ba529fdbd72298e1f378db1e127d43d8/webpack.config.production.js#L46. This plugin replaces __DEV__ with the NODE_ENV check.

cooperka commented 7 years ago

I'm getting a very similar error using React Native v0.43

Comment moved to new issue: https://github.com/4Catalyzer/babel-plugin-dev-expression/issues/4