Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
hiifong committed Oct 7, 2024
1 parent c08cc90 commit 4436fa4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import { PrimeVueResolver } from 'unplugin-vue-components/resolvers'
import { chunkSplitPlugin } from 'vite-plugin-chunk-split'

// https://github.com/rollup/rollup/blob/master/src/utils/sanitizeFileName.ts
// https://datatracker.ietf.org/doc/html/rfc2396
// eslint-disable-next-line no-control-regex
const INVALID_CHAR_REGEX = /[\u0000-\u001F"#$%&*+_,:;<=>?[\]^`{|}\u007F]/g // Add '_' char
// const DRIVE_LETTER_REGEX = /^[a-z]:/i

// https://vitejs.dev/config/
export default defineConfig({
build: {
Expand All @@ -24,6 +30,10 @@ export default defineConfig({
}
return '[name].[hash].[ext]'
},
sanitizeFileName(name: string): string {
// 去掉无效的字符
return name.replaceAll(INVALID_CHAR_REGEX, '')
},
minifyInternalExports: true
}
}
Expand Down

0 comments on commit 4436fa4

Please sign in to comment.