Ensure prod builds don't use inline source maps

The bundle grew by a factor of 4, so let's only do that while
we're developing.
This commit is contained in:
Søren L. Hansen 2022-11-26 15:21:59 -08:00
parent 29c20dca06
commit 59ddaa82b8
5 changed files with 547 additions and 159 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

686
js/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -14,7 +14,8 @@
"ts-loader": "^8.3.0", "ts-loader": "^8.3.0",
"typescript": "^4.3.2", "typescript": "^4.3.2",
"webpack": "^5.72.0", "webpack": "^5.72.0",
"webpack-cli": "^4.7.0" "webpack-cli": "^4.7.0",
"webpack-dev-server": "^4.11.1"
}, },
"dependencies": { "dependencies": {
"@popperjs/core": "^2.11.5", "@popperjs/core": "^2.11.5",
@ -24,7 +25,6 @@
"preact": "^10.7.1", "preact": "^10.7.1",
"react-bootstrap": "^2.2.3", "react-bootstrap": "^2.2.3",
"style-loader": "^2.0.0", "style-loader": "^2.0.0",
"webpack-dev-server": "^4.11.1",
"xterm": "^4.12.0", "xterm": "^4.12.0",
"xterm-addon-fit": "^0.5.0", "xterm-addon-fit": "^0.5.0",
"xterm-addon-web-links": "^0.4.0", "xterm-addon-web-links": "^0.4.0",

View File

@ -2,6 +2,14 @@ const path = require('path');
const TerserPlugin = require("terser-webpack-plugin"); const TerserPlugin = require("terser-webpack-plugin");
const LicenseWebpackPlugin = require('license-webpack-plugin').LicenseWebpackPlugin; const LicenseWebpackPlugin = require('license-webpack-plugin').LicenseWebpackPlugin;
var devtool;
if (process.env.DEV === '1') {
devtool = 'inline-source-map';
} else {
devtool = 'source-map';
}
module.exports = { module.exports = {
entry: "./src/main.ts", entry: "./src/main.ts",
entry: { entry: {
@ -10,7 +18,7 @@ module.exports = {
output: { output: {
path: path.resolve(__dirname, '../bindata/static/js/'), path: path.resolve(__dirname, '../bindata/static/js/'),
}, },
devtool: "inline-source-map", devtool: devtool,
resolve: { resolve: {
extensions: [".ts", ".tsx", ".js"], extensions: [".ts", ".tsx", ".js"],
}, },