-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathvite.config.js
52 lines (51 loc) · 1.33 KB
/
vite.config.js
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
40
41
42
43
44
45
46
47
48
49
50
51
52
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import vue from "@vitejs/plugin-vue";
import path from "path";
import tailwindcss from "@tailwindcss/vite";
export default defineConfig({
plugins: [react(), vue(), tailwindcss()],
root: path.resolve(__dirname, 'frontend'),
build: {
outDir: path.resolve(__dirname, 'public'),
emptyOutDir: true,
rollupOptions: {
input: {
app: path.resolve(__dirname, 'frontend/js/app.js')
},
output: {
entryFileNames: 'js/[name].js',
chunkFileNames: 'js/[name]-[hash].js',
assetFileNames: (assetInfo) => {
const info = assetInfo.name.split('.')
const ext = info[info.length - 1]
if (/\.(css|scss|sass|less)$/.test(assetInfo.name)) {
return 'css/[name]-[hash][extname]'
}
return `${ext}/[name]-[hash][extname]`
}
}
}
},
css: {
preprocessorOptions: {
scss: {
additionalData: `@import "${path.resolve(__dirname, 'frontend/sass/variables.scss')}";`
},
less: {
javascriptEnabled: true
}
}
},
resolve: {
alias: {
'@': path.resolve(__dirname, 'frontend/js'),
'@sass': path.resolve(__dirname, 'frontend/sass')
}
},
server: {
watch: {
usePolling: true
}
}
});