|
@@ -14,6 +14,17 @@ export default defineConfig({
|
|
|
|
|
|
plugins: [
|
|
|
|
|
|
+
|
|
|
+ viteCompression({
|
|
|
+ algorithm: "gzip",
|
|
|
+ ext: ".gz",
|
|
|
+ threshold: 10240,
|
|
|
+ deleteOriginFile: false,
|
|
|
+ filter: /\.(js|css|json|html|ico|svg)(\?.*)?$/i,
|
|
|
+ compressionOptions: { level: 9 },
|
|
|
+ verbose: true,
|
|
|
+ disable: false,
|
|
|
+ }),
|
|
|
legacy({
|
|
|
targets: ["Chrome 63"],
|
|
|
additionalLegacyPolyfills: ["regenerator-runtime/runtime"],
|
|
@@ -35,11 +46,30 @@ export default defineConfig({
|
|
|
},
|
|
|
},
|
|
|
build: {
|
|
|
+ minify: 'terser',
|
|
|
+ terserOptions: {
|
|
|
+ compress: {
|
|
|
+ pure_funcs: ['console.log'],
|
|
|
+
|
|
|
+ drop_debugger: true,
|
|
|
+ }
|
|
|
+ },
|
|
|
rollupOptions: {
|
|
|
input: {
|
|
|
instrument: resolve(__dirname, "instrument.html"),
|
|
|
},
|
|
|
output: {
|
|
|
+
|
|
|
+ manualChunks(id) {
|
|
|
+ if (id.includes("osmd-extended")) {
|
|
|
+
|
|
|
+ return id
|
|
|
+ .toString()
|
|
|
+ .split("osmd-extended/")[1]
|
|
|
+ .split("/")[0]
|
|
|
+ .toString();
|
|
|
+ }
|
|
|
+ },
|
|
|
chunkFileNames: "js/[name]-[hash].js",
|
|
|
entryFileNames: "js/[name]-[hash].js",
|
|
|
assetFileNames: "[ext]/[name]-[hash].[ext]",
|