mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-12-11 09:11:50 +00:00
Update webpack and simplify config
Update some webpack dependencies and remove unused ones. Replace worker-loader with built-in worker loading functionality and remove default/implied options from the webpack configuration files.
This commit is contained in:
parent
ca5dd9b3e5
commit
ba2e74b993
@ -53,18 +53,6 @@ const moduleRules = [
|
|||||||
fullySpecified: false,
|
fullySpecified: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
test: /\.worker\.[jt]s$/,
|
|
||||||
use: [
|
|
||||||
{
|
|
||||||
loader: "worker-loader",
|
|
||||||
options: {
|
|
||||||
filename: "[fullhash].worker.js",
|
|
||||||
inline: "fallback",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/** @type {import("webpack").Configuration} */
|
/** @type {import("webpack").Configuration} */
|
||||||
@ -98,7 +86,4 @@ export default {
|
|||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
module: { rules: moduleRules },
|
module: { rules: moduleRules },
|
||||||
experiments: {
|
|
||||||
topLevelAwait: true,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -62,18 +62,6 @@ const moduleRules = [
|
|||||||
fullySpecified: false,
|
fullySpecified: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
test: /\.worker\.[jt]s$/,
|
|
||||||
use: [
|
|
||||||
{
|
|
||||||
loader: "worker-loader",
|
|
||||||
options: {
|
|
||||||
filename: "[fullhash].worker.js",
|
|
||||||
inline: "fallback",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/** @type {import("webpack").Configuration} */
|
/** @type {import("webpack").Configuration} */
|
||||||
@ -94,35 +82,19 @@ export default {
|
|||||||
extensions: [".ts", ".js", ".tsx", ".jsx"],
|
extensions: [".ts", ".js", ".tsx", ".jsx"],
|
||||||
},
|
},
|
||||||
stats: { optimizationBailout: true },
|
stats: { optimizationBailout: true },
|
||||||
devtool: false,
|
|
||||||
optimization: {
|
optimization: {
|
||||||
noEmitOnErrors: true,
|
|
||||||
removeAvailableModules: true,
|
removeAvailableModules: true,
|
||||||
removeEmptyChunks: true,
|
|
||||||
mergeDuplicateChunks: true,
|
|
||||||
flagIncludedChunks: true,
|
|
||||||
providedExports: true,
|
|
||||||
usedExports: true,
|
|
||||||
concatenateModules: true,
|
|
||||||
sideEffects: true,
|
|
||||||
minimizer: [
|
minimizer: [
|
||||||
new TerserPlugin({
|
new TerserPlugin({
|
||||||
parallel: true,
|
parallel: true,
|
||||||
terserOptions: {
|
terserOptions: {
|
||||||
ecma: 2020,
|
ecma: 2020,
|
||||||
parse: {},
|
|
||||||
module: true,
|
module: true,
|
||||||
toplevel: true,
|
|
||||||
keep_classnames: true,
|
|
||||||
keep_fnames: true,
|
keep_fnames: true,
|
||||||
compress: {
|
compress: {
|
||||||
arguments: false,
|
|
||||||
drop_console: false,
|
|
||||||
global_defs: globalDefs,
|
global_defs: globalDefs,
|
||||||
keep_fargs: true,
|
|
||||||
keep_infinity: true,
|
keep_infinity: true,
|
||||||
passes: 2,
|
passes: 2,
|
||||||
module: true,
|
|
||||||
pure_funcs: [
|
pure_funcs: [
|
||||||
"Math.radians",
|
"Math.radians",
|
||||||
"Math.degrees",
|
"Math.degrees",
|
||||||
@ -141,23 +113,11 @@ export default {
|
|||||||
"Math.pow",
|
"Math.pow",
|
||||||
"Math.atan2",
|
"Math.atan2",
|
||||||
],
|
],
|
||||||
toplevel: true,
|
|
||||||
unsafe_math: true,
|
unsafe_math: true,
|
||||||
unsafe_arrows: false,
|
|
||||||
},
|
},
|
||||||
mangle: {
|
format: {
|
||||||
eval: true,
|
|
||||||
keep_classnames: true,
|
|
||||||
keep_fnames: true,
|
|
||||||
module: true,
|
|
||||||
toplevel: true,
|
|
||||||
},
|
|
||||||
output: {
|
|
||||||
comments: false,
|
comments: false,
|
||||||
ascii_only: true,
|
ascii_only: true,
|
||||||
beautify: false,
|
|
||||||
braces: false,
|
|
||||||
ecma: 2020,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
@ -176,7 +136,4 @@ export default {
|
|||||||
maxEntrypointSize: 5120000,
|
maxEntrypointSize: 5120000,
|
||||||
maxAssetSize: 5120000,
|
maxAssetSize: 5120000,
|
||||||
},
|
},
|
||||||
experiments: {
|
|
||||||
topLevelAwait: true,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|||||||
713
package-lock.json
generated
713
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -36,7 +36,6 @@
|
|||||||
"@types/gulp": "^4.0.9",
|
"@types/gulp": "^4.0.9",
|
||||||
"@types/gulp-htmlmin": "^1.3.32",
|
"@types/gulp-htmlmin": "^1.3.32",
|
||||||
"@types/node": "^22.14.0",
|
"@types/node": "^22.14.0",
|
||||||
"@types/webpack": "^5.28.0",
|
|
||||||
"browser-sync": "^2.27.10",
|
"browser-sync": "^2.27.10",
|
||||||
"circular-dependency-plugin": "^5.2.2",
|
"circular-dependency-plugin": "^5.2.2",
|
||||||
"css-mqpacker": "^7.0.0",
|
"css-mqpacker": "^7.0.0",
|
||||||
@ -71,15 +70,14 @@
|
|||||||
"postcss-preset-env": "^6.5.0",
|
"postcss-preset-env": "^6.5.0",
|
||||||
"postcss-round-subpixels": "^1.2.0",
|
"postcss-round-subpixels": "^1.2.0",
|
||||||
"prettier": "^3.3.2",
|
"prettier": "^3.3.2",
|
||||||
"terser-webpack-plugin": "^5.3.6",
|
"terser-webpack-plugin": "^5.3.14",
|
||||||
"ts-loader": "^9.4.2",
|
"ts-loader": "^9.5.2",
|
||||||
"typescript": "^5.8.2",
|
"typescript": "^5.8.2",
|
||||||
"typescript-eslint": "^8.29.1",
|
"typescript-eslint": "^8.29.1",
|
||||||
"webpack": "^5.75.0",
|
"webpack": "^5.99.9",
|
||||||
"webpack-deadcode-plugin": "^0.1.17",
|
"webpack-deadcode-plugin": "^0.1.17",
|
||||||
"webpack-stream": "^7.0.0",
|
"webpack-stream": "^7.0.0",
|
||||||
"webpack-strip-block": "^0.2.0",
|
"webpack-strip-block": "^0.2.0",
|
||||||
"worker-loader": "^3.0.8",
|
|
||||||
"yaml": "^1.10.0"
|
"yaml": "^1.10.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,5 @@
|
|||||||
import { Signal } from "./signal";
|
import { Signal } from "./signal";
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
import BackgroundAnimationFrameEmitterWorker from "../webworkers/background_animation_frame_emittter.worker";
|
|
||||||
|
|
||||||
import { createLogger } from "./logging";
|
import { createLogger } from "./logging";
|
||||||
const logger = createLogger("animation_frame");
|
const logger = createLogger("animation_frame");
|
||||||
|
|
||||||
@ -21,7 +18,9 @@ export class AnimationFrame {
|
|||||||
|
|
||||||
this.boundMethod = this.handleAnimationFrame.bind(this);
|
this.boundMethod = this.handleAnimationFrame.bind(this);
|
||||||
|
|
||||||
this.backgroundWorker = new BackgroundAnimationFrameEmitterWorker();
|
this.backgroundWorker = new Worker(
|
||||||
|
new URL("../webworkers/background_animation_frame_emittter", import.meta.url)
|
||||||
|
);
|
||||||
this.backgroundWorker.addEventListener("error", err => {
|
this.backgroundWorker.addEventListener("error", err => {
|
||||||
logger.error("Error in background fps worker:", err);
|
logger.error("Error in background fps worker:", err);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
/// <reference lib="WebWorker" />
|
||||||
|
|
||||||
// We clamp high deltas so 30 fps is fairly ok
|
// We clamp high deltas so 30 fps is fairly ok
|
||||||
const bgFps = 30;
|
const bgFps = 30;
|
||||||
const desiredMsDelay = 1000 / bgFps;
|
const desiredMsDelay = 1000 / bgFps;
|
||||||
@ -9,7 +11,6 @@ function tick() {
|
|||||||
const delta = now - lastTick;
|
const delta = now - lastTick;
|
||||||
lastTick = now;
|
lastTick = now;
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
self.postMessage({ delta });
|
self.postMessage({ delta });
|
||||||
}
|
}
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user