diff --git a/Dockerfile b/Dockerfile index de55f7538..0fc4fcd80 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,6 +27,11 @@ RUN \ ln -s "./config/config.yaml" "config.yaml" || true && \ mkdir "config" || true +# Pre-compile public libraries +RUN \ + echo "*** Run Webpack ***" && \ + node "./docker/build-lib.js" + # Cleanup unnecessary files RUN \ echo "*** Cleanup ***" && \ diff --git a/docker/build-lib.js b/docker/build-lib.js new file mode 100644 index 000000000..7676ec075 --- /dev/null +++ b/docker/build-lib.js @@ -0,0 +1,4 @@ +import getWebpackServeMiddleware from '../src/middleware/webpack-serve.js'; + +const middleware = getWebpackServeMiddleware(); +await middleware.runWebpackCompiler(); diff --git a/src/middleware/webpack-serve.js b/src/middleware/webpack-serve.js index c1dc73fd4..9bf758922 100644 --- a/src/middleware/webpack-serve.js +++ b/src/middleware/webpack-serve.js @@ -36,7 +36,9 @@ export default function getWebpackServeMiddleware() { console.log(output); console.log(); } - resolve(); + compiler.close(() => { + resolve(); + }); }); }); };