-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.ts
55 lines (52 loc) · 1.31 KB
/
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import { viteStaticCopy } from "vite-plugin-static-copy";
import path, { extname, relative } from "path";
import { fileURLToPath } from "node:url";
import { glob } from "glob";
const external = [/node_modules/];
const input = Object.fromEntries(
glob
.sync("src/**/*.{ts,css}", {
ignore: ["src/**/*.d.ts"],
})
.map((file: any) => [
// The name of the entry point
// lib/nested/foo.ts becomes nested/foo
relative("src", file.slice(0, file.length - extname(file).length)),
// The absolute path to the entry file
// lib/nested/foo.ts becomes /project/lib/nested/foo.ts
fileURLToPath(new URL(file, import.meta.url)),
])
);
input["main"] = "index.html";
input["build"] = "build.css";
export default defineConfig({
plugins: [
react(),
viteStaticCopy({
targets: [
{
src: "public/manifest.json",
dest: ".",
},
{ src: "public/images", dest: "." },
],
}),
],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
build: {
minify: false,
rollupOptions: {
input: input,
output: {
assetFileNames: "assets/[name][extname]",
entryFileNames: "[name].js",
},
},
},
});