From 48786f1e59916b505401bafcd3593b054c4c0361 Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Sat, 20 Mar 2021 02:58:52 +0100 Subject: [PATCH] Fix --dev-plugin breaking after bd53339 The automatic determination of the public path for plugins works correctly when they are build for production and loaded from their respective paths. But when the dev middelware compiles it, it doesn't know the correct path to host it at withouth the publicPath being set. Fix by setting publicPath explicitly when compiling with the dev middleware. --- packages/master/master.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/master/master.js b/packages/master/master.js index f82e2b31..4f2e6ee6 100755 --- a/packages/master/master.js +++ b/packages/master/master.js @@ -2012,7 +2012,7 @@ async function startServer(args) { const webpackDevMiddleware = require("webpack-dev-middleware"); const webpackConfigs = []; if (args.dev) { - webpackConfigs.push(require("./webpack.config")); + webpackConfigs.push(require("./webpack.config")({})); } if (args.devPlugin) { for (let name of args.devPlugin) { @@ -2020,14 +2020,14 @@ async function startServer(args) { if (!info) { throw new libErrors.StartupError(`No plugin named ${name}`); } - webpackConfigs.push( - require(path.posix.join(info.requirePath, "webpack.config")) - ); + let config = require(path.posix.join(info.requirePath, "webpack.config"))({}); + config.output.publicPath = `/plugins/${name}/`; + webpackConfigs.push(config); } } /* eslint-enable global-require */ - const compiler = webpack(webpackConfigs.map(config => config({}))); + const compiler = webpack(webpackConfigs); devMiddleware = webpackDevMiddleware(compiler, {}); app.use(devMiddleware); }