diff --git a/scripts/server-frontend-dev.js b/scripts/server-frontend-dev.js index 496672f..63f0903 100644 --- a/scripts/server-frontend-dev.js +++ b/scripts/server-frontend-dev.js @@ -1,5 +1,6 @@ import webpack from "webpack"; import config from "../config/webpack.dev.js"; +import WebpackDevServer from "webpack-dev-server"; const devServerConfig = { proxy: { @@ -13,8 +14,7 @@ const devServerConfig = { }, }; -export default async function startFrontendDevServer(port, resolve) { - let WebpackDevServer = (await import("webpack-dev-server")).WebpackDevServer; +export async function startFrontendDevServer(port, resolve) { resolve(1); await new WebpackDevServer(webpack(config), devServerConfig).start(port, (err) => { if (err) { diff --git a/scripts/server.js b/scripts/server.js index 4c3c542..8903ea2 100644 --- a/scripts/server.js +++ b/scripts/server.js @@ -1,6 +1,5 @@ import { getArgs } from "./utils.js"; import startBackendServer from "./server-backend.js"; -import startFrontendDevServer from "./server-frontend-dev.js"; const SERVER_MODES = { 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; if (server_mode === SERVER_MODES.DEVELOPMENT) { + let startFrontendDevServer = (await import("./server-frontend-dev.js")).startFrontendDevServer; console.info("Starting server in development mode."); startFrontendDevServer(8080, function () { // this time, it's the frontend server that is on port 8080