generated from allen-cell-animated/github-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.js
40 lines (35 loc) · 1.36 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
import react from "@vitejs/plugin-react";
import { resolve } from "path";
import { defineConfig } from "vite";
import glsl from "vite-plugin-glsl";
import svgr from "vite-plugin-svgr";
// Add version number and build timestamp to the environment variables
export const DEFAULT_ENV = {
...process.env,
VITE_APP_VERSION: process.env.npm_package_version,
VITE_BUILD_TIME_UTC: Date.now().toString(),
};
process.env = DEFAULT_ENV;
export const DEFAULT_CONFIG = {
build: {
// This quiets the "module has been externalized for browser compatibility" warnings that
// vite throws when building for production.
// commonjsOptions: {
// // Ignore built-in modules in Node.js. Fix copied from the workerpool documentation:
// // https://github.com/josdejong/workerpool/blob/master/examples/vite/vite.config.ts
// ignore: ["os", "child_process", "worker_threads"],
// },
rollupOptions: {
input: {
// TODO: Currently 404.html imports all of the same JS chunks as index.html.
// Can we make it so that 404.html only imports `gh_404.js` chunks?
// eslint-disable-next-line no-undef
main: resolve(__dirname, "index.html"),
// eslint-disable-next-line no-undef
404: resolve(__dirname, "404.html"),
},
},
},
plugins: [svgr(), glsl(), react()],
};
export default defineConfig(DEFAULT_CONFIG);