only load modules if we are in production
This commit is contained in:
parent
c634ef04d1
commit
7e2c08bdd6
12
package.json
12
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",
|
||||
|
@ -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;
|
Loading…
x
Reference in New Issue
Block a user