thelounge/src/plugins/dev-server.js
Eric Nemchik 2e3d9a6265
Fix yarn dev (#4574)
* Fix yarn dev and yarn test
2022-05-21 11:45:42 -07:00

29 lines
710 B
JavaScript

"use strict";
module.exports = (app) => {
const log = require("../log");
log.debug("Starting server in development mode");
const webpack = require("webpack");
const webpackConfig = require("../../webpack.config.js")(undefined, {mode: "production"});
webpackConfig.plugins.push(new webpack.HotModuleReplacementPlugin());
webpackConfig.entry["js/bundle.js"].push(
"webpack-hot-middleware/client?path=storage/__webpack_hmr"
);
const compiler = webpack(webpackConfig);
app.use(
require("webpack-dev-middleware")(compiler, {
index: "/",
publicPath: webpackConfig.output.publicPath,
})
).use(
require("webpack-hot-middleware")(compiler, {
path: "/storage/__webpack_hmr",
})
);
};