I have a Node js server app which uses Express
and Pug
. I would like to bundle it to single script which can be deployed by pm2
. There seem to be several problems with this.
- In runtime I get
Cannot find module "."
and during compilation few messages like
WARNING in ./node_modules/express/lib/view.js 80:29-41 Critical dependency: the request of a dependency is an expression
appear which come from dynamic imports like require(mod).__express
. I assume Webpack can't statically resolve those and does not know which dependency to include.
How can this be solved ?
- How do I make
Pug
compile and be part of the output js ?