From d157e1b92619e2cdff5b66964ba5d7243e23031a Mon Sep 17 00:00:00 2001 From: Ivan Bochkarev Date: Thu, 16 Jul 2026 09:31:37 +0600 Subject: [PATCH] fix(vue-manager): clean vue-dist before Vite build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace partial index*.min.js prebuild wipe with full rimraf of js/css vue-dist so hashed orphan chunks cannot accumulate. Keep emptyOutDir false — outDir is the repo root. --- vueManager/package.json | 3 ++- vueManager/vite.config.js | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/vueManager/package.json b/vueManager/package.json index 370f116e..caffec79 100644 --- a/vueManager/package.json +++ b/vueManager/package.json @@ -5,7 +5,8 @@ "type": "module", "scripts": { "dev": "vite", - "prebuild": "rimraf ../assets/components/minishop3/js/mgr/vue-dist/index*.min.js", + "clean:vue-dist": "rimraf ../assets/components/minishop3/js/mgr/vue-dist ../assets/components/minishop3/css/mgr/vue-dist", + "prebuild": "npm run clean:vue-dist", "build": "vite build", "preview": "vite preview", "lint": "eslint . --fix", diff --git a/vueManager/vite.config.js b/vueManager/vite.config.js index d4f87d5e..2d29b45f 100644 --- a/vueManager/vite.config.js +++ b/vueManager/vite.config.js @@ -5,11 +5,13 @@ import prefixSelector from 'postcss-prefix-selector' import { defineConfig } from 'vite' import vueDevTools from 'vite-plugin-vue-devtools' +// outDir is the repo root — never set emptyOutDir:true here. +// Orphan hashed chunks are removed by `npm run clean:vue-dist` (prebuild). const output = { dir: '../', assetFileNames: 'assets/components/minishop3/css/mgr/vue-dist/[name].min[extname]', // css files chunkFileNames: 'assets/components/minishop3/js/mgr/vue-dist/[name]-[hash].min.js', // js chunks (hash avoids stale cache) - entryFileNames: 'assets/components/minishop3/js/mgr/vue-dist/[name].min.js', // main js file (entry point) + entryFileNames: 'assets/components/minishop3/js/mgr/vue-dist/[name].min.js', // fixed entry names for MODX } const DevInput = { @@ -130,6 +132,9 @@ export default defineConfig(({ command }) => { // command === 'build' return { build: { + // Safe: outDir is '../' (repo root). Full wipe would delete the project. + // vue-dist dirs are cleaned by package.json prebuild → clean:vue-dist. + emptyOutDir: false, rollupOptions: { output, input: ProdInput,