entwicklerstube/babel-plugin-root-import

Why save to dev dependency?

James2516 opened this issue · 3 comments

Since this plugin is needed for the production build to transform the imports, why does the installation guide uses --dev?

I just got bitten by this. Very true. Docs need to be changed.

Most Babel documentation assumes that you are doing all your transpiling as part of a build step and won't need any of the babel pieces in production (except maybe for babel-polyfill). In my experience that is the way most people are using it and so that's a totally reasonable assumption.

If you are using a setup where you need to install babel plugins as regular dependencies instead of dev dependencies, then it's really up to you (and the documentation of whatever tool is causing that problem) to know that, you can't expect every babel plugin to document all the possible ways you can use babel.

@jasonk, agreed.

For client side projects, the convention is to use dependencies for things that'll be included in the bundle/dist, and devDependencies for everything else.

For server projects, I usually have all of my deps + dev deps installed, run babel on the source files, and then switch to only having dependencies installed before deploying. This means that dependencies is strictly the runtime requirements of the server app.