fix import dev deps

This commit is contained in:
Raphael 2024-05-07 11:47:01 +02:00
parent 00e2074f88
commit 4c9f82ea33
2 changed files with 3 additions and 3 deletions

View File

@ -1,5 +1,6 @@
import webpack from "webpack"; import webpack from "webpack";
import config from "../config/webpack.dev.js"; import config from "../config/webpack.dev.js";
import WebpackDevServer from "webpack-dev-server";
const devServerConfig = { const devServerConfig = {
proxy: { proxy: {
@ -13,8 +14,7 @@ const devServerConfig = {
}, },
}; };
export default async function startFrontendDevServer(port, resolve) { export async function startFrontendDevServer(port, resolve) {
let WebpackDevServer = (await import("webpack-dev-server")).WebpackDevServer;
resolve(1); resolve(1);
await new WebpackDevServer(webpack(config), devServerConfig).start(port, (err) => { await new WebpackDevServer(webpack(config), devServerConfig).start(port, (err) => {
if (err) { if (err) {

View File

@ -1,6 +1,5 @@
import { getArgs } from "./utils.js"; import { getArgs } from "./utils.js";
import startBackendServer from "./server-backend.js"; import startBackendServer from "./server-backend.js";
import startFrontendDevServer from "./server-frontend-dev.js";
const SERVER_MODES = { const SERVER_MODES = {
PRODUCTION: 1, PRODUCTION: 1,
@ -21,6 +20,7 @@ if (args.mode !== "production" && args.mode !== "development") {
const server_mode = args.mode === "production" ? SERVER_MODES.PRODUCTION : SERVER_MODES.DEVELOPMENT; const server_mode = args.mode === "production" ? SERVER_MODES.PRODUCTION : SERVER_MODES.DEVELOPMENT;
if (server_mode === SERVER_MODES.DEVELOPMENT) { if (server_mode === SERVER_MODES.DEVELOPMENT) {
let startFrontendDevServer = (await import("./server-frontend-dev.js")).startFrontendDevServer;
console.info("Starting server in development mode."); console.info("Starting server in development mode.");
startFrontendDevServer(8080, function () { startFrontendDevServer(8080, function () {
// this time, it's the frontend server that is on port 8080 // this time, it's the frontend server that is on port 8080