GithubHelp home page GithubHelp logo

babel-plugin-dev-expression's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar emmilco avatar jquense avatar renovate-bot avatar renovate[bot] avatar swyxio avatar taion avatar trysound avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

babel-plugin-dev-expression's Issues

Doesn't work with React Native

I got a very similar issue to #2 using React Native v0.43. After some testing, it turns out this plugin doesn't work at all with React Native :(

Property property of MemberExpression expected node to be of a type ["Identifier"] but instead got "BinaryExpression"

Working demo project: https://github.com/cooperka/DemoDevExpression

Full stack:

error: bundling: TypeError: /Users/me/dev/apps/my-app/node_modules/react-native/packager/src/Resolver/polyfills/prelude_dev.js: Property property of MemberExpression expected node to be of a type ["Identifier"] but instead got "BinaryExpression"
    at validate (/Users/me/dev/apps/my-app/node_modules/babel-types/lib/definitions/index.js:109:13)
    at Object.validate (/Users/me/dev/apps/my-app/node_modules/babel-types/lib/definitions/core.js:412:50)
    at Object.validate (/Users/me/dev/apps/my-app/node_modules/babel-types/lib/index.js:505:9)
    at NodePath._replaceWith (/Users/me/dev/apps/my-app/node_modules/babel-traverse/lib/path/replacement.js:176:7)
    at NodePath.replaceWith (/Users/me/dev/apps/my-app/node_modules/babel-traverse/lib/path/replacement.js:160:8)
    at PluginPass.enter (/Users/me/dev/apps/my-app/node_modules/babel-plugin-dev-expression/dev-expression.js:41:18)
    at newFn (/Users/me/dev/apps/my-app/node_modules/babel-traverse/lib/visitors.js:276:21)
    at NodePath._call (/Users/me/dev/apps/my-app/node_modules/babel-traverse/lib/path/context.js:76:18)
    at NodePath.call (/Users/me/dev/apps/my-app/node_modules/babel-traverse/lib/path/context.js:48:17)
TransformError: /Users/me/dev/apps/my-app/node_modules/react-native/packager/src/Resolver/polyfills/prelude_dev.js: /Users/me/dev/apps/my-app/node_modules/react-native/packager/src/Resolver/polyfills/prelude_dev.js: Property property of MemberExpression expected node to be of a type ["Identifier"] but instead got "BinaryExpression"
Bundling `index.ios.js`  100.0% (1991/1991), failed.

.babelrc:

{
  "presets": ["react-native"],
  "plugins": ["dev-expression"]
}

Any idea what's going on or how to fix it?

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

npm
package.json
  • @babel/plugin-transform-modules-commonjs ^7.15.4
  • codecov ^3.8.1
  • jest ^26.6.3
  • prettier ^2.4.1
travis
.travis.yml

  • Check this box to trigger a request for Renovate to run again on this repository

Change to `process?.env?.NODE_ENV`?

In order to make the ESM builds work on modern browsers, without additional bundlers involved, would you consider change the way process.env.NODE_ENV is accessed to gracefully handle a missing process?

process?.env?.NODE_ENV or maybe process?.env.NODE_ENV should be enough.

babel6 support?

Hi!

Noticed today that babel-plugin-dev-expression works with babel 5.4.7
but can't use it with babel 6.3.13.

TypeError: t.literal is not a function
    at module.exports (/.../node_modules/babel-plugin-dev-expression/dev-expression.js:26:7)

Transformation issue with es2015

I noticed that my commonjs build included the incorrectly transformed invariant(false).

This is incorrect as the import is being transformed to var _invariant and invariant isn't defined.

The issue can be reproduced in babel repl.

Not sure if invariant(false) can be converted to (0, _invariant.default)(false) or whatever.

wrap the import?

I'm wondering if it would aslo make sens to let the plugin wrap the import/require of the warning dependency with a process.env.NODE_ENV !== 'production' block.

That shouldn't make any different when using a flat bundler like rollup but I think that would save us some module tree traversal when using a bundler like webpack.

Add this plugin throw a TypeError

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.