I am not quite sure I follow…

nodeExternals will actually make sure that node_modules will not be bundled inside your final output. They will be loaded like a relative `require()` in both production and development.

It is logical to have a MUCH larger webpack build in production since you don’t use nodeExternals in production — which leaves me wondering why did you choose to go down this road.

My server actually works by using nodeExternals in both development and production mode. The bundle output contains only my code and not any third party code. When building for production in my CI, I always do an “npm install” so the node_modules folder is present in production.

Software Architect, currently @ Vodafone GR. Past: Lead Dev @ Intrasoft Intl, atcom.gr and more. Crafting apps & web services since 2007. https://oramind.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store