EvanAgee / vuejs-wordpress-theme-starter

A WordPress theme with the guts ripped out and replaced with Vue.
https://vuewp.com/
1.6k stars 282 forks source link

Why is vuex loaded as a dev dependency? #98

Open simplenotezy opened 4 years ago

simplenotezy commented 4 years ago

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

EvanAgee commented 4 years ago

@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.

simplenotezy commented 4 years ago

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

austin880625 commented 4 years ago

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