-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathvite.config.js
47 lines (43 loc) · 1.2 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
import {defineConfig} from "vite";
import {glob} from "glob";
import {resolve} from "path";
const inputs = glob.sync('./frontend/*.js').reduce((acc, path) => {
// vue/pages/Admin/Index becomes AdminIndex
const entry = path.replace(/\.js$/g, '')
.replace(/^frontend\//g, '')
.replace(/\//g, '');
acc[entry] = resolve(__dirname, path)
return acc
}, {});
console.log(inputs);
// https://vitejs.dev/config/
export default defineConfig({
root: resolve(__dirname, "./frontend/"),
base: "/static/dist",
build: {
rollupOptions: {
input: inputs
},
manifest: true,
emptyOutDir: true,
chunkSizeWarningLimit: "1m",
outDir: resolve(__dirname, "./web/static/dist"),
},
server: {
strictPort: true,
host: true,
fs: {
allow: [
resolve(__dirname, './frontend/'),
resolve(__dirname, './node_modules/')
]
},
},
resolve: {
alias: {
"!": resolve(__dirname),
"~": resolve(__dirname, "./frontend"),
},
extensions: [".mjs", ".js", ".mts", ".ts", ".jsx", ".tsx", ".json", ".vue"],
},
});