diff --git a/package.json b/package.json index 567347d..b3290c7 100644 --- a/package.json +++ b/package.json @@ -45,11 +45,7 @@ "signature_pad": "^4.0.1", "socket.io-client": "^4.4.0", "uuid": "^8.1.0", - "webdav": "^5.3.0", - "webpack-dev-server": "^4.7.3", - "webpack": "^5.76.0", - "webpack-cli": "^4.9.2", - "webpack-merge": "^5.8.0" + "webdav": "^5.3.0" }, "devDependencies": { "@babel/cli": "^7.16.8", @@ -76,7 +72,11 @@ "prettier": "^2.5.1", "pretty-quick": "^2.0.1", "style-loader": "^1.1.4", - "vanilla-picker": "^2.12.1" + "vanilla-picker": "^2.12.1", + "webpack-dev-server": "^4.7.3", + "webpack": "^5.76.0", + "webpack-cli": "^4.9.2", + "webpack-merge": "^5.8.0" }, "author": "Cracker0dks", "license": "MIT", diff --git a/scripts/server-frontend-dev.js b/scripts/server-frontend-dev.js index 04aafb1..2fa7788 100644 --- a/scripts/server-frontend-dev.js +++ b/scripts/server-frontend-dev.js @@ -1,6 +1,14 @@ import webpack from "webpack"; import WebpackDevServer from "webpack-dev-server"; import config from "../config/webpack.dev.js"; +import { getArgs } from "./utils.js"; + +const args = getArgs(); + +if (typeof args.mode === "undefined") { + // default to production mode + args.mode = "production"; +} const devServerConfig = { hot: true, @@ -15,12 +23,21 @@ const devServerConfig = { }, }; -export default function startFrontendDevServer(port) { - new WebpackDevServer(webpack(config), devServerConfig).start(port, (err) => { - if (err) { - console.log(err); - } +let startFrontendDevServer = function() {} - console.log("Listening on port " + port); - }); +if (args.mode === "production") { + console.log("Not loading webpack-dev-server because of production mode!"); +} else { + startFrontendDevServer = function(port) { + new WebpackDevServer(webpack(config), devServerConfig).start(port, (err) => { + if (err) { + console.log(err); + } + + console.log("Listening on port " + port); + }); + } } + + +export default startFrontendDevServer; \ No newline at end of file