-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrollup.config.js
116 lines (110 loc) · 2.75 KB
/
rollup.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
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
import resolve from "@rollup/plugin-node-resolve"
import commonjs from "@rollup/plugin-commonjs"
import babel from "@rollup/plugin-babel"
import replace from "@rollup/plugin-replace"
import json from "@rollup/plugin-json"
import outputManifest from "rollup-plugin-output-manifest"
import includePaths from "rollup-plugin-includepaths"
import postcss from "rollup-plugin-postcss"
import del from "rollup-plugin-delete"
import tailwindcss from "tailwindcss"
import autoprefixer from "autoprefixer"
import matched from "matched"
const SRC_ROOT = "./src/property_app/js"
const DIST_ROOT = "./dist"
const REACT_EXPORTS = [
"Children",
"createRef",
"Component",
"PureComponent",
"createContext",
"forwardRef",
"lazy",
"memo",
"useCallback",
"useContext",
"useEffect",
"useImperativeHandle",
"useDebugValue",
"useLayoutEffect",
"useMemo",
"useReducer",
"useRef",
"useState",
"Fragment",
"Profiler",
"StrictMode",
"Suspense",
"createElement",
"cloneElement",
"isValidElement",
"createFactory",
"useTransition",
"useDeferredValue",
"SuspenseList",
"unstable_withSuspenseConfig",
"block",
"unstable_createFundamental",
"unstable_createScope",
"jsx",
"jsxs",
]
const REACT_SCHEDULER_EXPORTS = [
"unstable_ImmediatePriority",
"unstable_UserBlockingPriority",
"unstable_NormalPriority",
"unstable_IdlePriority",
"LowPriority",
"unstable_runWithPriority",
"unstable_next",
"unstable_scheduleCallback",
"unstable_cancelCallback",
"unstable_wrapCallback",
"unstable_getCurrentPriorityLevel",
"unstable_shouldYield",
"unstable_requestPaint",
"unstable_continueExecution",
"unstable_pauseExecution",
"unstable_getFirstCallbackNode",
"unstable_now",
"unstable_forceFrameRate",
]
const config = {
input: matched.sync([`${SRC_ROOT}/entry.js`, `${SRC_ROOT}/pages/*.js`]),
output: {
dir: `${DIST_ROOT}/assets/`,
entryFileNames: "[name].[hash].js",
},
plugins: [
del({
targets: "dist/*",
runOnce: true,
}),
babel({
exclude: "node_modules/**",
babelHelpers: "bundled",
presets: ["@babel/preset-env", "@babel/preset-react"],
plugins: ["@babel/plugin-syntax-dynamic-import"],
}),
resolve({ browser: true }),
json(),
includePaths({
paths: [`${SRC_ROOT}`],
extensions: [".js", ".css"],
}),
commonjs({
dynamicRequireTargets: [],
namedExports: {
"node_modules/react/index.js": REACT_EXPORTS,
"node_modules/scheduler/index.js": REACT_SCHEDULER_EXPORTS,
},
exclude: ["node_modules/lodash-es/**"],
}),
postcss({
plugins: [tailwindcss, autoprefixer],
}),
replace({ "process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV) }),
outputManifest(),
],
}
export default config