44

In variaous React documentation I see it being added as a prod dependency but I'm not understanding why. Shouldn't it be a devDependecy since SASS only gets compiled during development and when pushed to prod you are actually pushing the compiled CSS files?

2 Answers2

30

Since it's required to do a production build, it should be in the production dependencies list imho.

In my experience, most of the time the project gets build afresh for production, so needs all the packages required to build from scratch.

A dev dependency might something like webpack-dev-server which isn't needed for a prod build, but clearly is used in development (assuming one is using it).

jsdeveloper
  • 3,945
  • 1
  • 15
  • 14
  • 5
    That's one way to look at it, but this doesn't mean we are sharing the same beliefs. From my point of view, it's a dev dependency as it will help transpile the SASS to CSS - not required for running production code, as it is [axios](https://www.npmjs.com/package/axios). – HellBaby Aug 01 '22 at 19:04
  • I do not necessary agree as on the official Node website Babel is considered a development dependency: https://nodejs.dev/en/learn/npm-dependencies-and-devdependencies/ . Thank You and @user967451 anyway. – kcpr Sep 08 '22 at 22:14
  • Sass is not used in the browser. It's a build tool. It compiless .scss and .sass files to css. – emurano Jun 19 '23 at 23:10
7

On the official NPM site of sass (linked also here: " Sould SASS be installed as a 'dependency' or as a 'devDependency? ") it is suggested to install it as development dependency (aside from installing it globally) so I believe that's the way to go.

Also, as it's suggested on official Node website, Babel should be installed as a development dependency and that's the package that, I believe, may be required to create a production build. Considering that I think that all packages that are not required during runtime of an application should be installed as development dependencies.

kcpr
  • 1,055
  • 1
  • 12
  • 28