-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.build.ts
38 lines (35 loc) · 989 Bytes
/
vite.config.build.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
import * as path from "path";
import fs from "fs";
import { defineConfig } from "vite";
import svgr from "vite-plugin-svgr";
import react from "@vitejs/plugin-react";
import packageJson from "./package.json";
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
const localBuild = process.env.LOCAL_BUILD;
fs.copyFileSync(`main.html`, "index.html");
return {
base: localBuild ? undefined : packageJson.homepage,
plugins: [
react({
babel: {
plugins: ["@emotion/babel-plugin"],
},
}),
svgr(),
],
resolve: {
alias: [{ find: "@", replacement: path.resolve(__dirname, "src") }],
},
build: {
rollupOptions: {
input: {
main: path.resolve(__dirname, `index.html`),
bootstrap: path.resolve(__dirname, `bootstrap.html`),
mui: path.resolve(__dirname, `mui.html`),
404: path.resolve(__dirname, "404.html"),
},
},
},
};
});