diff --git a/runtime/vue3/build.vite.config.ts b/runtime/vue3/build.vite.config.ts index 54ba84ff1..c436500d0 100644 --- a/runtime/vue3/build.vite.config.ts +++ b/runtime/vue3/build.vite.config.ts @@ -25,6 +25,9 @@ import vueJsx from '@vitejs/plugin-vue-jsx'; // @ts-ignore import externalGlobals from 'rollup-plugin-external-globals'; +const INVALID_CHAR_REGEX = /[\x00-\x1F\x7F<>*#"{}|^[\]`;?:&=+$,]/g; +const DRIVE_LETTER_REGEX = /^[a-z]:/i; + export default defineConfig(({ mode }) => { if (['value', 'config', 'event', 'ds:value', 'ds:config', 'ds:event'].includes(mode)) { const capitalToken = mode @@ -80,6 +83,14 @@ export default defineConfig(({ mode }) => { outDir: path.resolve(process.cwd(), `../../playground/public/runtime/vue3/${mode}`), rollupOptions: { external: ['vue', 'vue-demi'], + output: { + // https://github.com/rollup/rollup/blob/master/src/utils/sanitizeFileName.ts + sanitizeFileName(name) { + const match = DRIVE_LETTER_REGEX.exec(name); + const driveLetter = match ? match[0] : ''; + return driveLetter + name.slice(driveLetter.length).replace(INVALID_CHAR_REGEX, ''); + }, + }, }, }, };