mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-15 23:24:52 +09:00
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.
This commit is contained in:
1 parent
3d26371fa9
commit
48786f1e59
1 file changed
+5
-5
@@ -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);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user