-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.dev.ts
More file actions
39 lines (35 loc) · 892 Bytes
/
vite.config.dev.ts
File metadata and controls
39 lines (35 loc) · 892 Bytes
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
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 mainApp = process.env.MAIN_APP;
if (!mainApp) {
throw new Error("MAIN_APP should be specified");
}
fs.copyFileSync(`${mainApp}.html`, "index.html");
return {
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`),
404: path.resolve(__dirname, "404.html"),
},
},
},
};
});