#Bundled main.js file with node_modules

2 messages · Page 1 of 1 (latest)

dense dock
#

Is it possible to create a bundled main.js file with all included?
Like node_modules / controllers / services ...

raven vortex
#

Is it possible? Yes. Should you do it? Probably not.

Reason being, many npm packages we use in the node environment end up having lower level bindings for things like c++ via node-gyp. mongo, bcrypt, argon2, and pg all have some of these bindings for example. These bindings then need to get transpiled and bundled into the final output which webpack starts to choke on, and then there's got to be a way to get node itself to ignore the syntax there due to not actually needing to interpret it. It's generally easier to just bundle your source code (services, controllers, modules) and leave the node_modules to still be installed on the server