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

Added .babelrc to .npmignore #1304

Merged
merged 1 commit into from
Mar 22, 2018
Merged

Added .babelrc to .npmignore #1304

merged 1 commit into from
Mar 22, 2018

Conversation

kedrzu
Copy link
Contributor

@kedrzu kedrzu commented Mar 21, 2018

Your .babelrc file is published to npm. This causes i.e that if I want to transpile my project along with dependencies, I am dependent on your babel configuration (plugins, presets, etc).

Could you please add .babelrc file to .npmignore?

@luisrudge
Copy link
Contributor

luisrudge commented Mar 21, 2018

can you point me to other projects that do this? I'm not sure what's the guideline for this file tbh

@kedrzu
Copy link
Contributor Author

kedrzu commented Mar 22, 2018

You can look i.e. on vuejs or react. They, however, do not use .npmignore, because they have a quite customized build chain, so they don't need it. They both use babel, but if you look into their npm packages, there will be no .babelrc file.

For a full disclosure, why excluding .babelrc from npm would help:

Let's say you have a project with some third-party dependencies written in ES6. To be ES5 compliant you would use babel to transpile your project as well as your dependencies. When you include i.e. babel-loader for node_modules dependencies it would do the job.

Babel will then traverse directory tree to search for .babelrc file. Because auth0-lock includes its own .babelrc in npm package, the result is that it is being used by babel, along with your configured presets and plugins.

This results in indirect dependencies of my project to your babel setup and the need to install all the presets and plugins you use.

@luisrudge
Copy link
Contributor

Thanks for the explanation. That makes a lot of sense. I also found this: facebook/react-native#4062 (comment)

@luisrudge luisrudge merged commit f7073fe into auth0:master Mar 22, 2018
@kedrzu
Copy link
Contributor Author

kedrzu commented Mar 22, 2018

Great, you mentioned it, there is plenty of other npm modules that include .babelrc. I would have better argument :)

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

Successfully merging this pull request may close these issues.

2 participants