-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathvite.config.ts
39 lines (37 loc) · 869 Bytes
/
vite.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { fileURLToPath } from 'url'
import { defineConfig, loadEnv } from 'vite'
import { setupVitePlugins, sanitizeFileName } from './build'
// https://vitejs.dev/config/
export default defineConfig(env => {
const viteEnv = loadEnv(env.mode, process.cwd()) as ImportMetaEnv
const rootPath = fileURLToPath(new URL('./', import.meta.url))
const srcPath = `${rootPath}src`
return {
base: viteEnv.VITE_BASE_URL,
resolve: {
alias: {
'~': rootPath,
'@': srcPath
}
},
server: {
port: 3000,
host: true
},
plugins: setupVitePlugins(viteEnv),
css: {
preprocessorOptions: {
scss: {
additionalData: '@import "./src/styles/scss/index.scss";'
}
}
},
build: {
rollupOptions: {
output: {
sanitizeFileName
}
}
}
}
})