generated from art-institute-of-chicago/template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
43 lines (42 loc) · 1.42 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
41
42
43
import { defineConfig } from "vite";
import { resolve } from "path";
import react from "@vitejs/plugin-react";
// https://vitejs.dev/config/
export default defineConfig({
build: {
lib: {
entry: "src/MyMuseumTourBuilder.jsx",
formats: ["es"],
name: "MyMuseumTourBuilder",
},
rollupOptions: {
// We don't want to bundle React with our code, so we mark it as external
external: ["react", "react-dom", "react/jsx-runtime", "prop-types"],
output: {
entryFileNames: `[name].js`,
chunkFileNames: `[name].js`,
assetFileNames: `assets/[name].[ext]`,
globals: {
react: "react",
"react-dom": "ReactDOM",
"react/jsx-runtime": "react/jsx-runtime",
"prop-types": "PropTypes",
},
},
},
},
// This option avoids bundling excess code.
// It seems related to React 17+ changing the JSX runtime
// and may need to be re-evaluated if we upgrade React
// See:
// - https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html
// - https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md#jsxruntime
// - https://www.npmjs.com/package/@vitejs/plugin-react
plugins: [react({ jsxRuntime: "classic" })],
// Have static port for documentation purposes
server: {
port: 43110,
strictPort: true,
},
publicDir: resolve(__dirname, "cypress", "fixtures"),
});