Split bundles harder

This commit is contained in:
Michcio 2022-09-20 13:37:20 +02:00
parent ba331f771d
commit ac1072fd52
3 changed files with 35 additions and 1 deletions

View file

@ -100,6 +100,7 @@
"eslint": "^8.20.0", "eslint": "^8.20.0",
"eslint-plugin-import": "^2.26.0", "eslint-plugin-import": "^2.26.0",
"eslint-plugin-vue": "^9.1.1", "eslint-plugin-vue": "^9.1.1",
"rollup-plugin-sizes": "^1.0.4",
"start-server-and-test": "1.14.0" "start-server-and-test": "1.14.0"
} }
} }

View file

@ -1,5 +1,6 @@
import * as fs from 'fs'; import * as fs from 'fs';
import pluginVue from '@vitejs/plugin-vue'; import pluginVue from '@vitejs/plugin-vue';
import sizes from 'rollup-plugin-sizes';
import { defineConfig } from 'vite'; import { defineConfig } from 'vite';
import locales from '../../locales'; import locales from '../../locales';
@ -55,9 +56,14 @@ export default defineConfig(({ command, mode }) => {
input: { input: {
app: './src/init.ts', app: './src/init.ts',
}, },
plugins: process.env.NODE_ENV !== 'production' ? [
sizes(),
] : [],
output: { output: {
manualChunks: { manualChunks: {
vue: ['vue'], vue: ['vue', '@vue/runtime-core'],
mfmjs: ['mfm-js'],
photoswipe: ['photoswipe'],
}, },
}, },
}, },

View file

@ -4631,6 +4631,7 @@ __metadata:
reflect-metadata: 0.1.13 reflect-metadata: 0.1.13
rndstr: 1.0.0 rndstr: 1.0.0
rollup: 2.75.7 rollup: 2.75.7
rollup-plugin-sizes: ^1.0.4
sass: 1.53.0 sass: 1.53.0
seedrandom: 3.0.5 seedrandom: 3.0.5
start-server-and-test: 1.14.0 start-server-and-test: 1.14.0
@ -7326,6 +7327,13 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"filesize@npm:^6.0.1":
version: 6.4.0
resolution: "filesize@npm:6.4.0"
checksum: 83619b0a656225e84ba9a73271b80091629c0e88c2936c1ebd36fff96fb0e2fbae0273c2caccd522c02bc1a32ad9eba869c28c6b2c36e06187d25fd298c3dfe8
languageName: node
linkType: hard
"fill-range@npm:^4.0.0": "fill-range@npm:^4.0.0":
version: 4.0.0 version: 4.0.0
resolution: "fill-range@npm:4.0.0" resolution: "fill-range@npm:4.0.0"
@ -11620,6 +11628,13 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"module-details-from-path@npm:^1.0.3":
version: 1.0.3
resolution: "module-details-from-path@npm:1.0.3"
checksum: 378a8a26013889aa3086bfb0776b7860c5bb957336253e1ba5d779c2f239a218930b145ca76e52c1dd7c8079d52b2af64b8eec30822f81ffdb0dfa27d6fe6f33
languageName: node
linkType: hard
"moment@npm:^2.22.2": "moment@npm:^2.22.2":
version: 2.29.4 version: 2.29.4
resolution: "moment@npm:2.29.4" resolution: "moment@npm:2.29.4"
@ -14435,6 +14450,18 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"rollup-plugin-sizes@npm:^1.0.4":
version: 1.0.4
resolution: "rollup-plugin-sizes@npm:1.0.4"
dependencies:
filesize: ^6.0.1
module-details-from-path: ^1.0.3
peerDependencies:
rollup: ^2.0.0
checksum: 8672d72a335a0923fe70db7c2b338249b0914d2b574a07aed6504b4cf00d536cf7faef14a6bd648cf06d742298f0e641be755dea7c0fae7593f282ef91f85ed8
languageName: node
linkType: hard
"rollup@npm:2.75.7": "rollup@npm:2.75.7":
version: 2.75.7 version: 2.75.7
resolution: "rollup@npm:2.75.7" resolution: "rollup@npm:2.75.7"