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

Add .babelrc to .npmignore #124

Closed
kedrzu opened this issue Mar 21, 2018 · 3 comments
Closed

Add .babelrc to .npmignore #124

kedrzu opened this issue Mar 21, 2018 · 3 comments

Comments

@kedrzu
Copy link

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?

@linx4200
Copy link
Collaborator

Babel will look for a .babelrc in the current directory of the file being transpiled. If one does not exist, it will travel up the directory tree until it finds either a .babelrc, or a package.json with a "babel": {} hash within.

According to Babel's documentation, a .babelrv file in ./node_modules/vue-color would not affect your project.

@kedrzu
Copy link
Author

kedrzu commented Mar 22, 2018

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.

And, as you pointed out, babel will traverse directory tree to search for .babelrc file. Because vue-color 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.

As a reference look at the core vue project. They do use babel but don't include .babelrc in their final npm package. Adding this file to .npmignore would result in .babelrc file not being published to npm.

@linx4200
Copy link
Collaborator

linx4200 commented Apr 2, 2018

Sorry for the delay. Thanks for explanation. It's released on 2.4.6

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

2 participants