-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathvite.config.ts
38 lines (33 loc) · 1.09 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
import path from "path";
import react from "@vitejs/plugin-react";
import removeTestIdAttribute from "rollup-plugin-jsx-remove-attributes";
import { defineConfig, loadEnv } from "vite";
import relay from "vite-plugin-relay";
// https://vitejs.dev/config/
const plugins = [relay, react()];
export default defineConfig(({ mode }) => {
process.env = { ...process.env, ...loadEnv(mode, process.cwd()) };
const testAttributeRemoverPlugin =
// keep this one last, the storybook config pops it off
removeTestIdAttribute({
attributes: ["data-testid", "data-chromatic"], // remove test attributes from jsx
usage: "vite"
});
if (process.env.VITE_DEV_MODE !== "false") {
plugins.push(testAttributeRemoverPlugin);
}
return {
build: {
rollupOptions: {
input: ["index.html", "src/main.tsx"]
},
manifest: "webpanelmanifest.json"
},
plugins,
resolve: {
alias: {
"@": path.resolve(__dirname, "./src")
}
}
};
});