2

If I add React Router to my React app, and I use Webpack to bundle my code, does it matter if I install React Router using --save-dev or not?

This question is not about the difference between --save and --save-dev, but about whether webpack handles devDependencies differently.

Titulum
  • 9,928
  • 11
  • 41
  • 79
  • 1
    Does this answer your question? [What is the difference between --save and --save-dev?](https://stackoverflow.com/questions/22891211/what-is-the-difference-between-save-and-save-dev) – Mike Doe Jan 14 '20 at 08:22
  • 2
    What do you mean *"care"*? When Webpack bundles your app it resolves library imports in node_modules/, how they got there isn't relevant. – jonrsharpe Jan 14 '20 at 08:24
  • That's the thing, I know the difference between `--save` and `--save-dev`, but this is a different question. Will webpack exclude dependencies if they are installed using `--save-dev`? That's my question. – Titulum Jan 14 '20 at 08:25
  • It would be relatively easy to test that out, no? Given that client build deps are generally not needed on a production server, I'd guess that *most* things Webpack ends up resolving and bundling are devDependencies. – jonrsharpe Jan 14 '20 at 08:30
  • 1
    webpack doesn’t care how a library got to the vendors directory as long as it’s there. – Mike Doe Jan 14 '20 at 08:31
  • 1
    Most questions on this website are easy to test, if we add this question people will find an answer quickly in the future. – Titulum Jan 14 '20 at 08:32

1 Answers1

-1

webpack does not care if a dependency is a devDependency or a regular dependency. It simply includes all code that is imported by the files that are iterated when bundling.

Titulum
  • 9,928
  • 11
  • 41
  • 79