mirror of
https://github.com/vitejs/vite.git
synced 2024-11-22 07:09:05 +00:00
28 lines
610 B
TypeScript
28 lines
610 B
TypeScript
import fs from 'node:fs'
|
|
import path from 'node:path'
|
|
import { defineConfig } from 'vite'
|
|
|
|
const escapeAliases = fs
|
|
.readdirSync(path.join(__dirname, 'escape'), { withFileTypes: true })
|
|
.filter((f) => f.isDirectory())
|
|
.map((f) => f.name)
|
|
.reduce((aliases: Record<string, string>, dir) => {
|
|
aliases[`@escape_${dir}_mod`] = path.resolve(
|
|
__dirname,
|
|
`./escape/${dir}/mod`,
|
|
)
|
|
return aliases
|
|
}, {})
|
|
|
|
export default defineConfig({
|
|
resolve: {
|
|
alias: {
|
|
...escapeAliases,
|
|
'@dir': path.resolve(__dirname, './dir/'),
|
|
},
|
|
},
|
|
build: {
|
|
sourcemap: true,
|
|
},
|
|
})
|