vuejs-wordpress-theme-starter icon indicating copy to clipboard operation
vuejs-wordpress-theme-starter copied to clipboard

Why is vuex loaded as a dev dependency?

Open simplenotezy opened this issue 5 years ago • 3 comments

I noticed vuex, vue-routing and more is loaded as a dev dependency. Is this on purpose, and if so, which?

simplenotezy avatar Feb 06 '20 12:02 simplenotezy

@simplenotezy Good question! By definition dev dependencies are only loaded during development and aren't necessary in production because all of our scripts are getting compiled into the dist directory during a production build process.

EvanAgee avatar Feb 06 '20 13:02 EvanAgee

OK I see. Then in theory, "vue" and "axios" could also be loaded as a dev dependency?

simplenotezy avatar Feb 06 '20 14:02 simplenotezy

dependencies and devDependencies are designed for node.js package (that is, for server side in common applications). If the application are bundled by webpack, everything are actually required and collected by webpack at the building process. And in runtime(i.e. on a browser), the bundle doesn't depend on any node.js package. So yes, things you mentioned can be dev dependencies in this case (if you weren't building bundles in production node environment).

A detailed explaination can be found here

austin880625 avatar Feb 18 '20 05:02 austin880625