Search code examples
javascriptnpmdependenciesbabeljsproduction

How do you setup dependencies for production deploy when Babel is used in build script?


My understanding is that Babel is used for compiling codes, so it makes sense to be placed at devDependencies.

But if I include Babel command in my build script and I would like to npm install --only=prod before npm run build at deploy stage (or Dockerfile).

Should I move Babel and related packages like plugins, preset into dependencies?


Solution

  • Just found out a reasonable solution.

    If the project needs to be built by babel, then

    our project is no longer considered the "front end app", but instead "the project that builds the front end app.

    Therefore installing babel related dependencies in production is fine.