The Webpack/Vue ecosystem is a very fragile one, with minor updates to loaders regularly breaking the build. It's basically a dedicated job to curate a working Webpack config together with a list of the exact dependency versions that are needed to make it work.
This Webpack config can easily be kept in a repository and then copied to many different projects and imported in their local webpack.config.js
because webpack.config.js
is just Javascript.
I'd like to do the same thing with package.json
, i.e. have the curated list of dependencies in a separate file and when running npm install
have them added to any other dependencies a project might have.
Do npm
or yarn
or any other external tools offer such a functionality?
Are you specifically trying to use a js file? If so, I don't have an answer, but if json is enough, you can just make an node package that just has the dependencies you want in it. Someone that includes your package will then pull in all the dependencies listed in your package because npm
pulls in the dependencies of a project's dependencies.