Question: if I have code referencing a devDependency. And that code continue to exist on prod, my app would break, correct? Then should I remove my code when deploying?
If your code references a dependency, it should be in dependencies, otherwise your app will break. You'd generally reserve devDependencies for things like babel plugins and presets, test runners. Things that are needed to compile your application.
Question: if I have code referencing a devDependency. And that code continue to exist on prod, my app would break, correct? Then should I remove my code when deploying?
Hi Vic,
If your code references a dependency, it should be in
dependencies
, otherwise your app will break. You'd generally reservedevDependencies
for things like babel plugins and presets, test runners. Things that are needed to compile your application.Make sense. Thank you.
Also one option would be to check envoriment. And when building for production uglify removes unnecessary code. See more in uglify documentation.
I actually use this also for building multible different sites from one source.