You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Webpack can bundle server code at single JS file, with all dependencies.
This allows to create Docker container with one server.js bundle, without unnecessary node_modules.
Some framework, NextJS for example, create one complete server bundle.
Problem
After mountebank integration as middleware, at existing application endpoint (see #610 issue), mountebank can be a part of this application server bundle.
At current time, bundled mountebank throw few errors:
errorhandler middleware try to read files from file system, on run server code, here code, and error example - ENOENT: no such file or directory, open 'http:/localhost:4000/dist/server/public/style.css
mountebank hardcode path to templates here, error example - Error: Failed to lookup view "imposters" in views directory "http:/localhost:4000/dist/server/views"
mountebank hardcode path to static resources here, impossible to load working HTML on different application endpoint
(low priority, ease to fix)express view try to require ejs on GET request to /imposters, use dynamic require and webpack can't bundle ejs module, more about problem here
Possible solutions
Working solution for 1, 2 and 4 cases - mark mountebank as external for webpack, and copy few libraries from node_modules to Docker container.
Problem here - you need to change Dockerfile.
Another solutions for errors from list:
Remove errorhandler or require it only on development mode
Don't have a solution =(
Add option publicPath to mountebank
Require ejs manually
Summary
1, 2 and 4 cases solvable with externals, if nobody have better solution.
But 3 case, looks like we need a publicPath in all cases.
The text was updated successfully, but these errors were encountered:
Prerequisites
Webpack can bundle server code at single JS file, with all dependencies.
This allows to create Docker container with one
server.js
bundle, without unnecessarynode_modules
.Some framework,
NextJS
for example, create one complete server bundle.Problem
After
mountebank
integration as middleware, at existing application endpoint (see #610 issue),mountebank
can be a part of this application server bundle.At current time, bundled
mountebank
throw few errors:errorhandler
middleware try to read files from file system, on run server code, here code, and error example -ENOENT: no such file or directory, open 'http:/localhost:4000/dist/server/public/style.css
mountebank
hardcode path to templates here, error example -Error: Failed to lookup view "imposters" in views directory "http:/localhost:4000/dist/server/views"
mountebank
hardcode path to static resources here, impossible to load working HTML on different application endpointexpress
view try to requireejs
on GET request to/imposters
, use dynamic require and webpack can't bundleejs
module, more about problem herePossible solutions
Working solution for 1, 2 and 4 cases - mark
mountebank
asexternal
forwebpack
, and copy few libraries fromnode_modules
to Docker container.Problem here - you need to change Dockerfile.
Another solutions for errors from list:
errorhandler
or require it only ondevelopment
modepublicPath
tomountebank
ejs
manuallySummary
1, 2 and 4 cases solvable with externals, if nobody have better solution.
But 3 case, looks like we need a
publicPath
in all cases.The text was updated successfully, but these errors were encountered: