This is my first question on SO so first of all a BIG HELLO and please excuse in case my question doesn't fit all critereas or seems akward.
I would like to know how my app is bundled and compiled with zeit's pkg.
Is the bundle inserted into the pre-sized binary?
Does it download the node sources like nexe and is code run as main or ist the snapshot loaded when the binary is executed?
I have a backend node-express server and a frontend angular app with each having their own node_modules folder like so:
myapp
|-------/client
| |
| |-----/e2e
| |-----/node_modules
| |-----/src
|
|-------/config
|
|-------/node_modules
|
|-------/routes
|
|--app.js
|
|--package.json
|
|--README.md
How does pkg treat those two instnces of node_modules?
Your help/expertise is highly appreciated!
The fact that there are several
node_modules
doesn't matter. In app.js,require('foo')
refers tomyapp/node_modules/foo
. Modules are bundled in a similar way they are resolved when they are loaded.pkg
packages only modules that are specified explicitly. As the documentation states,Not doing that will result in a warning during packaging: