The problem is as follows:
I make 4-5 small websites per week, and use tooling (webpack, ejs, etc..). So every site I've been working on, I did npm install
locally. It was OK with my old machine with HDD, but now I got a new laptop with SSD only (and have no chance to return to HDD). The point is, I'm afraid to kill my SSD drive too fast doing npm install
4 times a week. Is there any reasonable way to optimize this? Maybe can I install devDependencies
globally or install it somewhere once and link to them, and to install locally only prod dependencies
?
Here is my average package.json
deps:
"dependencies": {
"siema": "^1.5.1"
},
"devDependencies": {
"autoprefixer": "^9.1.5",
"copy-webpack-plugin": "^4.5.2",
"ejs-compiled-loader": "^1.1.0",
"group-css-media-queries-loader": "^2.0.2",
"postcss-loader": "^3.0.0",
"babel-core": "6.26.3",
"babel-loader": "7.1.5",
"babel-polyfill": "^6.0.16",
"babel-preset-env": "1.7.0",
"babel-preset-stage-0": "^6.0.15",
"clean-webpack-plugin": "0.1.19",
"cross-env": "5.2.0",
"css-loader": "1.0.0",
"file-loader": "1.1.11",
"html-webpack-plugin": "3.2.0",
"jimp": "^0.6.0",
"mini-css-extract-plugin": "^0.4.3",
"node-sass": "4.9.2",
"optimize-css-assets-webpack-plugin": "^5.0.1",
"puppeteer": "^1.11.0",
"raw-loader": "^1.0.0",
"sass-loader": "7.0.3",
"style-loader": "0.21.0",
"uglifyjs-webpack-plugin": "^2.0.1",
"url-loader": "1.0.1",
"webpack": "4.16.3",
"webpack-cli": "3.1.0",
"webpack-dev-server": "^3.1.10",
"webpack-merge": "4.1.3"
}
Thanks in advance.
UPDATE: Probably solved.
Referring to this thread, I've installed my devdeps at separate folder close to root, and at project's package.json
I've linked devdeps as follows:
"devDependencies": {
"autoprefixer": "file:c:/_npmg/node_modules/autoprefixer",
"copy-webpack-plugin": "file:c:/_npmg/node_modules/copy-webpack-plugin",
"ejs-compiled-loader": "file:c:/_npmg/node_modules/ejs-compiled-loader",
/* ... */
}
Results are like this:
...and everything is working just fine.
Now I wonder if this is the most proper solution for my case (considering that it is only local dev need, I don't use docker or something) or is there more optimal way.