-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.js
58 lines (52 loc) · 1.67 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
53
54
55
56
57
58
import { defineConfig } from "vite"
import { resolve } from "path"
import { globSync } from 'glob'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [],
root: resolve("."),
base: "/static/",
server: {
host: "localhost",
port: 3000,
open: false,
// This ensures assets referenced in CSS files (e.g. fonts)
// are served with full host during dev
origin: 'http://localhost:3000',
},
resolve: {
alias: {
/* Must be equivalent to aliases in tsconfig.json */
'@': resolve('.'),
},
resolve: {
extensions: [".js", ".vue", ".json"],
},
},
build: {
outDir: "sfs/vite-build",
assetsDir: "",
manifest: true,
emptyOutDir: true,
target: "es2017",
rollupOptions: {
input: Object.fromEntries(
/* We define ALL the ts files as entries
Although some are just imported from other ts files
so do not need to be entries of their own.
What we *really* want is for it to look through the templates
and pull out uses of vite_asset tags. That seems plausible.
For prod build those entries get written to:
sfs/static/build/manifest.json
.. and vite_asset reads from there.
*/
globSync('templates/**/*.ts').map(filename =>
[filename.replace(/\.ts$/, ''), filename]
)
),
output: {
chunkFileNames: undefined,
},
},
},
});