Optimizing webpack packaging

This commit is contained in:
MrKBear 2022-02-18 17:52:34 +08:00
parent c5014dc838
commit 4768cdb229
3 changed files with 11 additions and 5 deletions

View File

@ -54,14 +54,17 @@ const Entry = () => ({
import: source("./Model/Model.ts") import: source("./Model/Model.ts")
}, },
GLRender: {
import: source("./GLRender/ClassicRenderer.ts")
},
livingTogether: { livingTogether: {
import: source("./livingTogether.ts"), import: source("./livingTogether.ts")
dependOn: "Model",
}, },
LaboratoryPage: { LaboratoryPage: {
import: source("./Page/Laboratory/Laboratory.tsx"), import: source("./Page/Laboratory/Laboratory.tsx"),
dependOn: "Model", dependOn: ["Model", "GLRender"]
} }
}); });

View File

@ -11,6 +11,7 @@ module.exports = (env) => {
const config = { const config = {
entry: { entry: {
GLRender: AllEntry.GLRender,
Model: AllEntry.Model, Model: AllEntry.Model,
LaboratoryPage: AllEntry.LaboratoryPage LaboratoryPage: AllEntry.LaboratoryPage
}, },
@ -21,10 +22,12 @@ module.exports = (env) => {
resolve: resolve(), resolve: resolve(),
optimization: { optimization: {
runtimeChunk: 'single',
chunkIds: 'named', chunkIds: 'named',
moduleIds: 'named', moduleIds: 'named',
splitChunks: { splitChunks: {
minSize: 1000, chunks: 'all',
minSize: 1000
} }
}, },

View File

@ -5,7 +5,7 @@
"main": "./source/LivingTogether.ts", "main": "./source/LivingTogether.ts",
"scripts": { "scripts": {
"clean": "rimraf ./build/*", "clean": "rimraf ./build/*",
"lab": "webpack serve --open --config ./config/webpack.lab.js", "hmr-lab": "webpack serve --open --config ./config/webpack.lab.js",
"build-lab": "npm run clean & webpack --mode development --config ./config/webpack.lab.js", "build-lab": "npm run clean & webpack --mode development --config ./config/webpack.lab.js",
"release-lab": "npm run clean & webpack --mode production --no-devtool --config ./config/webpack.lab.js" "release-lab": "npm run clean & webpack --mode production --no-devtool --config ./config/webpack.lab.js"
}, },