0

I am just so new to Webpack and NPM. So new that, I saw a webpack based project yesterday for the first time in my life. Well, it's difficult to grasp for a newbie like me. So, I installed the npm packages like npm install --save-dev html-webpack-plugin and few more to configure the webpack file. But I am little confused. So, all I want to know is, do I have do it(I mean go around and install the same npm packages) for each and every other projects that I build ? Because after installation the project file is like 50mb. Which is a lot I guess

Dark Devil
  • 35
  • 8
  • Does this answer your question? [doing npm install for each project takes too much space in drive](https://stackoverflow.com/questions/42781991/doing-npm-install-for-each-project-takes-too-much-space-in-drive) – user202729 Sep 26 '20 at 09:09
  • nope, that is not what I am asking for – Dark Devil Sep 26 '20 at 09:12
  • 1
    It's recommended you install all these dependencies on per-project bases. However, if disk space is really your concern (which I doubt), you can globally install these plugins/loaders in the root `node_modules` folder. You can do this by `npm install -g html-webpack-plugin`. But you risk spending time debugging weird case when you hit version incompatibility. – hackape Sep 26 '20 at 09:12
  • why? Have you read the other question/answer? (edit the question to clarify.) – user202729 Sep 26 '20 at 09:13
  • Its 2020, 50mb is not much. Besides you will `build` the project to deploy it on a hosting which wouldn't take that much space if you don't have large assets – Anurag Srivastava Sep 26 '20 at 09:14
  • node.js toolchains evolve so quick, things break a lot. I did show you a solution, but I really don't recommend it. – hackape Sep 26 '20 at 09:14
  • @hackape okay man thank you, that's all I wanted hear. I mean that 'you install all these dependencies on per-project bases'. And no disk space isn't my concern but I have this question now, the 40mb file, the whole file get loaded on the browser or just my files ? – Dark Devil Sep 26 '20 at 09:15
  • 1
    Just your file. Those are building tools, not bundled result. – hackape Sep 26 '20 at 09:17
  • Side note. You might want to check out `parcel-bundler`. It's less configurable compared to `webpack`, but really hassle-free. It's my personal go-to choice as starting point of new projects these days. – hackape Sep 26 '20 at 09:19
  • @user202729 please read my question thoroughly. It's not so confusing – Dark Devil Sep 26 '20 at 09:21
  • @hackape thank you for your suggestion, I will take a look at it. Thanks again – Dark Devil Sep 26 '20 at 09:22

0 Answers0