Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do I need node_modules folder on live host server if I'm using webpack?

To be clear, I am not asking if I need node_modules folder on live host server. That question & answer exists on Stack Overflow already. The consensus answer, in general is YES - I still need the node_modules directory during runtime.

I am also not asking about running npm init or npm install. I understand how that works.

I am specifically asking - do I still need the node_modules directory on the live/host server if I use webpack during my build process? Doesn't webpack bundle all the necessary JS, etc into folder? Can I delete the node_modules folder if use webpack? Or, will I still need that directory during runtime?

This is for a basic front end, client side web application only. This front end calls other API only for backend sevice. This front end web application is being hosted on Windows/IIS.

The site's published code includes static references like this:

<link rel="stylesheet" href="/css/app.css?id=f243e9c6546d420fec1f">
<script src="/js/app.js?id=bf7be8f179cc272c0190"></script>

Ignore the id= part, as I think that's part of the web framework for cache busting.

like image 300
Steve Kennedy Avatar asked Sep 07 '18 18:09

Steve Kennedy


1 Answers

No, everything is in the bundle after you build. You can take the files defined as output (usually whatever is in the "dist" folder) and stick them on whatever static server you want without the need of the supporting node_modules.

like image 157
zero298 Avatar answered Sep 21 '22 02:09

zero298