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

Babel config in package.json problem #198

Open
megafinz opened this issue Dec 19, 2018 · 0 comments
Open

Babel config in package.json problem #198

megafinz opened this issue Dec 19, 2018 · 0 comments

Comments

@megafinz
Copy link

Hi.

We're happen to use react-popover 0.5.10 (with React 16) in our project which is compiled by Babel 6.X. The problem is:

  1. react-popover source code contains call to Object.assign: https://github.com/littlebits/react-popover/blob/905e7545e32806abf8ee38f4557621e9bc5b1c1a/source/index.js#L487

  2. Seems that there is no polyfill configured for Object.assign is react-popover's build pipeline so this call ends up in the build output.

  3. Babel configuration for react-popover lives in package.json file which is included in distribution package.

  4. We have transform-object-assign plugin enabled in our build pipeline for node_modules, but Babel 6.X has this weird behavior that when it stumbles upon a package.json#babel that is closer to the file it compiles than the root config file (.babelrc in our case), then it uses this newly found config instead of our root config, so our plugins are ignored and Object.assign call stays there.

  5. IE11 doesn't like Object.assign, so we're having problems there.

Seems like Babel is aware of this configuration issue and fixed this in Babel 7.X, so we're migrating towards it (babel/babel#6766).

Anyway, maybe react-popover can

  1. Get rid of the Object.assign call in this simple case

  2. Move Babel config from package.json#babel into .babelrc and put that .babelrc into .npmignore so it's excluded from the distribution package and doesn't cause issues for users of Babel 6.X (similar issue: Extract babel config into .babelrc file and add it to .npmignore LinusBorg/portal-vue#32).

Thanks.

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