-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.js
More file actions
77 lines (73 loc) · 1.92 KB
/
vite.config.js
File metadata and controls
77 lines (73 loc) · 1.92 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react-swc'
import path from "path";
const NODE_ENV = process.env.NODE_ENV;
const __DEV__ = NODE_ENV === "development";
// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
resolve: {
alias: [
{
find: /^react$/,
replacement: path.resolve(__dirname, "./packages/_react"),
},
{
find: /^react\/(.*)$/,
replacement: path.resolve(__dirname, "./packages/_react/$1"),
},
{
find: /^shared\/(.*)$/,
replacement: path.resolve(__dirname, "./packages/_shared/$1"),
},
{
find: /^react-dom$/,
replacement: path.resolve(__dirname, "./packages/_react-dom"),
},
{
find: /^react-dom\/(.*)$/,
replacement: path.resolve(__dirname, "./packages/_react-dom/$1"),
},
{
find: /^react-dom-bindings\/(.*)$/,
replacement: path.resolve(
__dirname,
"./packages/_react-dom-bindings/$1"
),
},
{
find: /^react-reconciler\/(.*)$/,
replacement: path.resolve(__dirname, "./packages/_react-reconciler/$1"),
},
{
find: /^react-client\/(.*)$/,
replacement: path.resolve(__dirname, "./packages/_react-client/$1"),
},
{
find: /^scheduler$/,
replacement: path.resolve(__dirname, "./packages/_scheduler"),
},
],
preserveSymlinks: true,
},
optimizeDeps: {
include: ["shared/ReactSharedInternals"],
exclude: ["react"],
},
// build: {
// 生产模式不必要
// production unnecessary
// },
define: {
__DEV__,
__EXPERIMENTAL__: true,
__EXTENSION__: false,
__PROFILE__: false,
__TEST__: NODE_ENV === "test",
// TODO: Should this be feature tested somehow?
__IS_CHROME__: false,
__IS_FIREFOX__: false,
__IS_EDGE__: false,
__IS_NATIVE__: false,
},
})