This repository has been archived by the owner on Dec 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
next.config.base.js
182 lines (163 loc) · 4.76 KB
/
next.config.base.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
const path = require("path");
const withTM = require("next-transpile-modules")(
[
// app & core
"@grida.co/app",
"@app/scene-view",
"@app/blocks",
"@app/cms-posts",
"@app/cms-forms",
"@app/fp-customer-support",
"@core/state",
"@core/app-state",
"@core/store",
"@core/model",
// ui
"@ui/tags-input",
"@ui/date-picker",
// https://github.com/vercel/next.js/discussions/13553#discussioncomment-20092 ----------------------------
// cause of this, we also set `experimental: { esmExternals: "loose" }`
"react-tag-input",
"react-dnd",
"dnd-core",
"@react-dnd/invariant",
"@react-dnd/asap",
"@react-dnd/shallowequal",
// --------------------------------------------------------------------------------------------------------
// utils
"treearray",
// boring
"@boring.so/store",
"@boring.so/loader",
"@boring.so/config",
"@boringso/react-core",
"@boring.so/document-model",
"@boring.so/template-provider",
// region editor-submodule deps
"@base-sdk-fp/core",
"@base-sdk-fp/auth",
"@base-sdk-fp/accounts",
"@base-sdk-fp/auth-components-react",
// -----------------------------
// region @designto-code
"@designto/config",
"@grida/builder-config-preset",
"@grida/builder-platform-types",
"@designto/code",
"@designto/sanitized",
"@designto/token",
"@designto/flutter",
"@designto/web",
"@designto/vanilla",
"@designto/react",
"@designto/react-native",
"@code-features/assets",
"@code-features/component",
"@code-features/flags",
// -----------------------------
// -----------------------------
// region @design-sdk
"@design-sdk/flags",
"@design-sdk/core",
"@design-sdk/core-types",
"@design-sdk/universal",
"@design-sdk/diff",
"@design-sdk/figma",
"@design-sdk/figma-node",
"@design-sdk/figma-types",
"@design-sdk/figma-url",
"@design-sdk/figma-node-conversion",
"@design-sdk/figma-remote",
"@design-sdk/figma-remote-api",
// "@design-sdk/figma-remote-types",
"@design-sdk/url-analysis",
"@design-sdk/sketch",
// -----------------------------
// -----------------------------
// region @reflect-ui types & utils
"@reflect-ui/core",
"@reflect-ui/detection",
// -----------------------------
// -----------------------------
// base sdk
"@base-sdk/core",
"@base-sdk/base",
"@base-sdk/url",
"@base-sdk/hosting",
"@base-sdk/resources",
"@base-sdk/scene-store",
// -----------------------------
// reflect-ui ui framework
// @editor-ui ui components
"@editor-ui/editor",
"@editor-ui/hierarchy",
"@editor-ui/spacer",
"@editor-ui/utils",
"@editor-ui/button",
// -----------------------------
// region coli
"coli",
"@coli.codes/escape-string",
"@coli.codes/core-syntax-kind",
// endregion coli
// -----------------------------
// -----------------------------
// region builders - part of designto-code / coli
// region web builders
"@web-builder/nodejs",
"@web-builder/core",
"@web-builder/vanilla",
"@web-builder/react-core",
"@web-builder/react",
"@web-builder/react-native",
"@web-builder/reflect-ui",
"@web-builder/styled",
"@web-builder/styles",
// endregion web builders
// -----------------------------
],
{
// resolveSymlinks: true,
debug: process.env === "development",
}
);
const TerserPlugin = require("terser-webpack-plugin");
const webpack =
(__dirname) =>
(config, { isServer }) => {
// -----------------------------
// for @flutter-builder classname issue
config.optimization.minimizer.push(
new TerserPlugin({
parallel: true,
terserOptions: {
// https://github.com/webpack-contrib/terser-webpack-plugin#terseroptions
keep_classnames: true,
},
})
);
// -----------------------------
config.resolve.fallback = {
net: false,
tls: false,
child_process: false,
fs: false, // used by handlebars
path: false, // used by handlebars
crypto: false, // or crypto-browserify (used for totp auth)
stream: false, // or stream-browserify (used for totp auth)
};
// https://www.npmjs.com/package/next-transpile-modules#i-have-trouble-with-duplicated-dependencies-or-the-invalid-hook-call-error-in-react
if (isServer) {
console.log("server app");
config.externals = ["react", ...config.externals];
}
const reactPath = path.resolve(__dirname, "..", "node_modules", "react");
console.log("reactPath", reactPath);
config.resolve.alias["react"] = reactPath;
//
return config;
};
module.exports = {
withTM,
webpack,
};