@hpcc-js/esbuild-plugins 1.8.3 → 1.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +43 -43
- package/README.md +45 -45
- package/dist/index.js.map +1 -1
- package/dist/sfx-wrapper.js +23 -23
- package/dist/sfx-wrapper.js.map +4 -4
- package/package.json +5 -5
- package/src/build.ts +177 -177
- package/src/exclude-sourcemap.ts +20 -20
- package/src/index.ts +8 -8
- package/src/inline-css.ts +44 -44
- package/src/package-version-plugin.ts +87 -87
- package/src/problem-matcher.ts +24 -24
- package/src/rebuild-logger.ts +24 -24
- package/src/remove-strict.ts +21 -21
- package/src/sfx-wrapper.ts +152 -152
- package/src/vite-utils.ts +259 -259
package/src/vite-utils.ts
CHANGED
|
@@ -1,260 +1,260 @@
|
|
|
1
|
-
import { configDefaults, defineConfig, ViteUserConfig } from "vitest/config";
|
|
2
|
-
import cssInjectedByJsPlugin from "vite-plugin-css-injected-by-js";
|
|
3
|
-
import { viteStaticCopy } from "vite-plugin-static-copy";
|
|
4
|
-
import { packageVersionPlugin } from "./package-version-plugin.ts";
|
|
5
|
-
import { readFileSync } from "fs";
|
|
6
|
-
import { resolve, dirname } from "path";
|
|
7
|
-
import { fileURLToPath } from "url";
|
|
8
|
-
|
|
9
|
-
const alias = {
|
|
10
|
-
"d3-array": "@hpcc-js/common",
|
|
11
|
-
"d3-brush": "@hpcc-js/common",
|
|
12
|
-
"d3-collection": "@hpcc-js/common",
|
|
13
|
-
"d3-color": "@hpcc-js/common",
|
|
14
|
-
"d3-dispatch": "@hpcc-js/common",
|
|
15
|
-
"d3-drag": "@hpcc-js/common",
|
|
16
|
-
"d3-dsv": "@hpcc-js/common",
|
|
17
|
-
"d3-ease": "@hpcc-js/common",
|
|
18
|
-
"d3-format": "@hpcc-js/common",
|
|
19
|
-
"d3-interpolate": "@hpcc-js/common",
|
|
20
|
-
"d3-scale": "@hpcc-js/common",
|
|
21
|
-
"d3-selection": "@hpcc-js/common",
|
|
22
|
-
"d3-time-format": "@hpcc-js/common",
|
|
23
|
-
"d3-transition": "@hpcc-js/common",
|
|
24
|
-
"d3-zoom": "@hpcc-js/common"
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Find and read the root package.json (monorepo root)
|
|
29
|
-
* Walks up the directory tree looking for a package.json with "workspaces"
|
|
30
|
-
*/
|
|
31
|
-
function getRootPackageVersion(): string {
|
|
32
|
-
try {
|
|
33
|
-
// Try to find root package.json by walking up from current file
|
|
34
|
-
let currentDir = dirname(fileURLToPath(import.meta.url));
|
|
35
|
-
let attempts = 0;
|
|
36
|
-
const maxAttempts = 10;
|
|
37
|
-
|
|
38
|
-
while (attempts < maxAttempts) {
|
|
39
|
-
try {
|
|
40
|
-
const pkgPath = resolve(currentDir, "package.json");
|
|
41
|
-
const pkgContent = readFileSync(pkgPath, "utf-8");
|
|
42
|
-
const pkg = JSON.parse(pkgContent);
|
|
43
|
-
|
|
44
|
-
// Check if this is the root by looking for workspaces
|
|
45
|
-
if (pkg.workspaces) {
|
|
46
|
-
return pkg.version;
|
|
47
|
-
}
|
|
48
|
-
} catch {
|
|
49
|
-
// File doesn't exist or couldn't be read, continue up
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const parentDir = dirname(currentDir);
|
|
53
|
-
if (parentDir === currentDir) {
|
|
54
|
-
// Reached filesystem root
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
currentDir = parentDir;
|
|
58
|
-
attempts++;
|
|
59
|
-
}
|
|
60
|
-
} catch (error) {
|
|
61
|
-
console.warn("Could not read root package.json, using package version as build version:", error);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return "";
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export function hpccBundleNames(pkg: any) {
|
|
68
|
-
const external: string[] = [];
|
|
69
|
-
const globals: { [id: string]: string } = {};
|
|
70
|
-
for (const dep in pkg.dependencies ?? {}) {
|
|
71
|
-
external.push(dep);
|
|
72
|
-
globals[dep] = dep;
|
|
73
|
-
}
|
|
74
|
-
for (const dep in pkg.peerDependencies ?? {}) {
|
|
75
|
-
external.push(dep);
|
|
76
|
-
globals[dep] = dep;
|
|
77
|
-
}
|
|
78
|
-
return { alias: (pkg.name !== "@hpcc-js/common" && pkg.dependencies?.["@hpcc-js/common"]) ? alias : {}, external, globals };
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
const commonCoverageConfig = {
|
|
82
|
-
reporter: ["text", "json", "html"],
|
|
83
|
-
exclude: [
|
|
84
|
-
...configDefaults.coverage.exclude || [],
|
|
85
|
-
"**/*.spec.ts",
|
|
86
|
-
"**/*.test.ts",
|
|
87
|
-
"**/tests/**",
|
|
88
|
-
"**/dist/**",
|
|
89
|
-
"**/lib-*/**",
|
|
90
|
-
"**/types/**",
|
|
91
|
-
]
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
export interface ViteHpccConfigOptions {
|
|
95
|
-
/**
|
|
96
|
-
* Additional external items
|
|
97
|
-
*/
|
|
98
|
-
external?: string[];
|
|
99
|
-
/**
|
|
100
|
-
* Additional plugins to include in the configuration
|
|
101
|
-
*/
|
|
102
|
-
plugins?: any[];
|
|
103
|
-
/**
|
|
104
|
-
* Whether to include font-awesome static copy (used by @hpcc-js/common)
|
|
105
|
-
*/
|
|
106
|
-
includeFontAwesome?: boolean;
|
|
107
|
-
/**
|
|
108
|
-
* Custom entry point (defaults to "src/index.ts")
|
|
109
|
-
*/
|
|
110
|
-
entry?: string;
|
|
111
|
-
/**
|
|
112
|
-
* Additional vite config options to merge
|
|
113
|
-
*/
|
|
114
|
-
configOverrides?: Partial<ViteUserConfig>;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export const nodeConfig = defineConfig({
|
|
118
|
-
test: {
|
|
119
|
-
name: "node",
|
|
120
|
-
|
|
121
|
-
exclude: [
|
|
122
|
-
...configDefaults.exclude,
|
|
123
|
-
"**/*.browser.spec.{ts,js}",
|
|
124
|
-
"**/node_modules/**",
|
|
125
|
-
"**/.nx/**",
|
|
126
|
-
"**/apps/**",
|
|
127
|
-
"**/components/**",
|
|
128
|
-
"**/demos/**",
|
|
129
|
-
],
|
|
130
|
-
environment: "node",
|
|
131
|
-
setupFiles: [],
|
|
132
|
-
coverage: {
|
|
133
|
-
provider: "v8",
|
|
134
|
-
...commonCoverageConfig
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
export const browserConfig = defineConfig({
|
|
140
|
-
test: {
|
|
141
|
-
exclude: [
|
|
142
|
-
...configDefaults.exclude,
|
|
143
|
-
"@hpcc-js/dgrid-shim",
|
|
144
|
-
"**/*.node.spec.{ts,js}",
|
|
145
|
-
"**/node_modules/**",
|
|
146
|
-
"**/.nx/**",
|
|
147
|
-
"**/apps/**",
|
|
148
|
-
"**/components/**",
|
|
149
|
-
"**/demos/**",
|
|
150
|
-
"**/src/**",
|
|
151
|
-
],
|
|
152
|
-
browser: {
|
|
153
|
-
enabled: true,
|
|
154
|
-
provider: "playwright",
|
|
155
|
-
instances: [{
|
|
156
|
-
name: "chromium",
|
|
157
|
-
browser: "chromium",
|
|
158
|
-
headless: true,
|
|
159
|
-
//@ts-expect-error
|
|
160
|
-
launch: {
|
|
161
|
-
args: ["--disable-web-security"],
|
|
162
|
-
}
|
|
163
|
-
}],
|
|
164
|
-
screenshotFailures: false,
|
|
165
|
-
},
|
|
166
|
-
setupFiles: [],
|
|
167
|
-
coverage: {
|
|
168
|
-
provider: "istanbul",
|
|
169
|
-
...commonCoverageConfig
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
export function createHpccViteConfig(pkg: any, options: ViteHpccConfigOptions = {}): ViteUserConfig {
|
|
175
|
-
const {
|
|
176
|
-
external: additionalExternal = [],
|
|
177
|
-
plugins: additionalPlugins = [],
|
|
178
|
-
includeFontAwesome = false,
|
|
179
|
-
entry = "src/index.ts",
|
|
180
|
-
configOverrides = {},
|
|
181
|
-
} = options;
|
|
182
|
-
|
|
183
|
-
const { alias, external, globals } = hpccBundleNames(pkg);
|
|
184
|
-
const allExternals = [...external, ...additionalExternal];
|
|
185
|
-
|
|
186
|
-
// Get build version from root package.json
|
|
187
|
-
const buildVersion = getRootPackageVersion() || pkg.version;
|
|
188
|
-
|
|
189
|
-
const allPlugins = [
|
|
190
|
-
packageVersionPlugin({ pkg, buildVersion }),
|
|
191
|
-
cssInjectedByJsPlugin({
|
|
192
|
-
topExecutionPriority: false
|
|
193
|
-
}),
|
|
194
|
-
...additionalPlugins
|
|
195
|
-
];
|
|
196
|
-
|
|
197
|
-
if (includeFontAwesome) {
|
|
198
|
-
allPlugins.push(
|
|
199
|
-
viteStaticCopy({
|
|
200
|
-
targets: [
|
|
201
|
-
{
|
|
202
|
-
src: "../../node_modules/font-awesome/fonts",
|
|
203
|
-
dest: "../font-awesome"
|
|
204
|
-
}, {
|
|
205
|
-
src: "../../node_modules/font-awesome/css",
|
|
206
|
-
dest: "../font-awesome",
|
|
207
|
-
}
|
|
208
|
-
]
|
|
209
|
-
})
|
|
210
|
-
);
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
const defaultLibConfig = {
|
|
214
|
-
entry,
|
|
215
|
-
name: pkg.name,
|
|
216
|
-
fileName: "index",
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
const config: ViteUserConfig = {
|
|
220
|
-
build: {
|
|
221
|
-
lib: {
|
|
222
|
-
...defaultLibConfig,
|
|
223
|
-
...(configOverrides.build?.lib || {})
|
|
224
|
-
},
|
|
225
|
-
rollupOptions: {
|
|
226
|
-
external: allExternals,
|
|
227
|
-
output: {
|
|
228
|
-
globals,
|
|
229
|
-
},
|
|
230
|
-
...(configOverrides.build?.rollupOptions || {})
|
|
231
|
-
},
|
|
232
|
-
// Preserve class names and function names in minified output
|
|
233
|
-
minify: "terser",
|
|
234
|
-
terserOptions: {
|
|
235
|
-
keep_classnames: true,
|
|
236
|
-
mangle: {
|
|
237
|
-
keep_classnames: true,
|
|
238
|
-
}
|
|
239
|
-
},
|
|
240
|
-
sourcemap: true,
|
|
241
|
-
...(configOverrides.build ? Object.fromEntries(Object.entries(configOverrides.build).filter(([key]) => key !== "lib" && key !== "rollupOptions")) : {})
|
|
242
|
-
},
|
|
243
|
-
resolve: {
|
|
244
|
-
alias,
|
|
245
|
-
...(configOverrides.resolve || {})
|
|
246
|
-
},
|
|
247
|
-
esbuild: {
|
|
248
|
-
keepNames: true,
|
|
249
|
-
...(configOverrides.esbuild || {})
|
|
250
|
-
},
|
|
251
|
-
plugins: allPlugins,
|
|
252
|
-
test: {
|
|
253
|
-
projects: [nodeConfig, browserConfig],
|
|
254
|
-
...(configOverrides.test || {})
|
|
255
|
-
},
|
|
256
|
-
...Object.fromEntries(Object.entries(configOverrides).filter(([key]) => !["build", "resolve", "esbuild", "plugins"].includes(key)))
|
|
257
|
-
};
|
|
258
|
-
|
|
259
|
-
return defineConfig(config);
|
|
1
|
+
import { configDefaults, defineConfig, ViteUserConfig } from "vitest/config";
|
|
2
|
+
import cssInjectedByJsPlugin from "vite-plugin-css-injected-by-js";
|
|
3
|
+
import { viteStaticCopy } from "vite-plugin-static-copy";
|
|
4
|
+
import { packageVersionPlugin } from "./package-version-plugin.ts";
|
|
5
|
+
import { readFileSync } from "fs";
|
|
6
|
+
import { resolve, dirname } from "path";
|
|
7
|
+
import { fileURLToPath } from "url";
|
|
8
|
+
|
|
9
|
+
const alias = {
|
|
10
|
+
"d3-array": "@hpcc-js/common",
|
|
11
|
+
"d3-brush": "@hpcc-js/common",
|
|
12
|
+
"d3-collection": "@hpcc-js/common",
|
|
13
|
+
"d3-color": "@hpcc-js/common",
|
|
14
|
+
"d3-dispatch": "@hpcc-js/common",
|
|
15
|
+
"d3-drag": "@hpcc-js/common",
|
|
16
|
+
"d3-dsv": "@hpcc-js/common",
|
|
17
|
+
"d3-ease": "@hpcc-js/common",
|
|
18
|
+
"d3-format": "@hpcc-js/common",
|
|
19
|
+
"d3-interpolate": "@hpcc-js/common",
|
|
20
|
+
"d3-scale": "@hpcc-js/common",
|
|
21
|
+
"d3-selection": "@hpcc-js/common",
|
|
22
|
+
"d3-time-format": "@hpcc-js/common",
|
|
23
|
+
"d3-transition": "@hpcc-js/common",
|
|
24
|
+
"d3-zoom": "@hpcc-js/common"
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Find and read the root package.json (monorepo root)
|
|
29
|
+
* Walks up the directory tree looking for a package.json with "workspaces"
|
|
30
|
+
*/
|
|
31
|
+
function getRootPackageVersion(): string {
|
|
32
|
+
try {
|
|
33
|
+
// Try to find root package.json by walking up from current file
|
|
34
|
+
let currentDir = dirname(fileURLToPath(import.meta.url));
|
|
35
|
+
let attempts = 0;
|
|
36
|
+
const maxAttempts = 10;
|
|
37
|
+
|
|
38
|
+
while (attempts < maxAttempts) {
|
|
39
|
+
try {
|
|
40
|
+
const pkgPath = resolve(currentDir, "package.json");
|
|
41
|
+
const pkgContent = readFileSync(pkgPath, "utf-8");
|
|
42
|
+
const pkg = JSON.parse(pkgContent);
|
|
43
|
+
|
|
44
|
+
// Check if this is the root by looking for workspaces
|
|
45
|
+
if (pkg.workspaces) {
|
|
46
|
+
return pkg.version;
|
|
47
|
+
}
|
|
48
|
+
} catch {
|
|
49
|
+
// File doesn't exist or couldn't be read, continue up
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const parentDir = dirname(currentDir);
|
|
53
|
+
if (parentDir === currentDir) {
|
|
54
|
+
// Reached filesystem root
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
currentDir = parentDir;
|
|
58
|
+
attempts++;
|
|
59
|
+
}
|
|
60
|
+
} catch (error) {
|
|
61
|
+
console.warn("Could not read root package.json, using package version as build version:", error);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return "";
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function hpccBundleNames(pkg: any) {
|
|
68
|
+
const external: string[] = [];
|
|
69
|
+
const globals: { [id: string]: string } = {};
|
|
70
|
+
for (const dep in pkg.dependencies ?? {}) {
|
|
71
|
+
external.push(dep);
|
|
72
|
+
globals[dep] = dep;
|
|
73
|
+
}
|
|
74
|
+
for (const dep in pkg.peerDependencies ?? {}) {
|
|
75
|
+
external.push(dep);
|
|
76
|
+
globals[dep] = dep;
|
|
77
|
+
}
|
|
78
|
+
return { alias: (pkg.name !== "@hpcc-js/common" && pkg.dependencies?.["@hpcc-js/common"]) ? alias : {}, external, globals };
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const commonCoverageConfig = {
|
|
82
|
+
reporter: ["text", "json", "html"],
|
|
83
|
+
exclude: [
|
|
84
|
+
...configDefaults.coverage.exclude || [],
|
|
85
|
+
"**/*.spec.ts",
|
|
86
|
+
"**/*.test.ts",
|
|
87
|
+
"**/tests/**",
|
|
88
|
+
"**/dist/**",
|
|
89
|
+
"**/lib-*/**",
|
|
90
|
+
"**/types/**",
|
|
91
|
+
]
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export interface ViteHpccConfigOptions {
|
|
95
|
+
/**
|
|
96
|
+
* Additional external items
|
|
97
|
+
*/
|
|
98
|
+
external?: string[];
|
|
99
|
+
/**
|
|
100
|
+
* Additional plugins to include in the configuration
|
|
101
|
+
*/
|
|
102
|
+
plugins?: any[];
|
|
103
|
+
/**
|
|
104
|
+
* Whether to include font-awesome static copy (used by @hpcc-js/common)
|
|
105
|
+
*/
|
|
106
|
+
includeFontAwesome?: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Custom entry point (defaults to "src/index.ts")
|
|
109
|
+
*/
|
|
110
|
+
entry?: string;
|
|
111
|
+
/**
|
|
112
|
+
* Additional vite config options to merge
|
|
113
|
+
*/
|
|
114
|
+
configOverrides?: Partial<ViteUserConfig>;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export const nodeConfig = defineConfig({
|
|
118
|
+
test: {
|
|
119
|
+
name: "node",
|
|
120
|
+
|
|
121
|
+
exclude: [
|
|
122
|
+
...configDefaults.exclude,
|
|
123
|
+
"**/*.browser.spec.{ts,js}",
|
|
124
|
+
"**/node_modules/**",
|
|
125
|
+
"**/.nx/**",
|
|
126
|
+
"**/apps/**",
|
|
127
|
+
"**/components/**",
|
|
128
|
+
"**/demos/**",
|
|
129
|
+
],
|
|
130
|
+
environment: "node",
|
|
131
|
+
setupFiles: [],
|
|
132
|
+
coverage: {
|
|
133
|
+
provider: "v8",
|
|
134
|
+
...commonCoverageConfig
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
export const browserConfig = defineConfig({
|
|
140
|
+
test: {
|
|
141
|
+
exclude: [
|
|
142
|
+
...configDefaults.exclude,
|
|
143
|
+
"@hpcc-js/dgrid-shim",
|
|
144
|
+
"**/*.node.spec.{ts,js}",
|
|
145
|
+
"**/node_modules/**",
|
|
146
|
+
"**/.nx/**",
|
|
147
|
+
"**/apps/**",
|
|
148
|
+
"**/components/**",
|
|
149
|
+
"**/demos/**",
|
|
150
|
+
"**/src/**",
|
|
151
|
+
],
|
|
152
|
+
browser: {
|
|
153
|
+
enabled: true,
|
|
154
|
+
provider: "playwright",
|
|
155
|
+
instances: [{
|
|
156
|
+
name: "chromium",
|
|
157
|
+
browser: "chromium",
|
|
158
|
+
headless: true,
|
|
159
|
+
//@ts-expect-error
|
|
160
|
+
launch: {
|
|
161
|
+
args: ["--disable-web-security"],
|
|
162
|
+
}
|
|
163
|
+
}],
|
|
164
|
+
screenshotFailures: false,
|
|
165
|
+
},
|
|
166
|
+
setupFiles: [],
|
|
167
|
+
coverage: {
|
|
168
|
+
provider: "istanbul",
|
|
169
|
+
...commonCoverageConfig
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
export function createHpccViteConfig(pkg: any, options: ViteHpccConfigOptions = {}): ViteUserConfig {
|
|
175
|
+
const {
|
|
176
|
+
external: additionalExternal = [],
|
|
177
|
+
plugins: additionalPlugins = [],
|
|
178
|
+
includeFontAwesome = false,
|
|
179
|
+
entry = "src/index.ts",
|
|
180
|
+
configOverrides = {},
|
|
181
|
+
} = options;
|
|
182
|
+
|
|
183
|
+
const { alias, external, globals } = hpccBundleNames(pkg);
|
|
184
|
+
const allExternals = [...external, ...additionalExternal];
|
|
185
|
+
|
|
186
|
+
// Get build version from root package.json
|
|
187
|
+
const buildVersion = getRootPackageVersion() || pkg.version;
|
|
188
|
+
|
|
189
|
+
const allPlugins = [
|
|
190
|
+
packageVersionPlugin({ pkg, buildVersion }),
|
|
191
|
+
cssInjectedByJsPlugin({
|
|
192
|
+
topExecutionPriority: false
|
|
193
|
+
}),
|
|
194
|
+
...additionalPlugins
|
|
195
|
+
];
|
|
196
|
+
|
|
197
|
+
if (includeFontAwesome) {
|
|
198
|
+
allPlugins.push(
|
|
199
|
+
viteStaticCopy({
|
|
200
|
+
targets: [
|
|
201
|
+
{
|
|
202
|
+
src: "../../node_modules/font-awesome/fonts",
|
|
203
|
+
dest: "../font-awesome"
|
|
204
|
+
}, {
|
|
205
|
+
src: "../../node_modules/font-awesome/css",
|
|
206
|
+
dest: "../font-awesome",
|
|
207
|
+
}
|
|
208
|
+
]
|
|
209
|
+
})
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
const defaultLibConfig = {
|
|
214
|
+
entry,
|
|
215
|
+
name: pkg.name,
|
|
216
|
+
fileName: "index",
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
const config: ViteUserConfig = {
|
|
220
|
+
build: {
|
|
221
|
+
lib: {
|
|
222
|
+
...defaultLibConfig,
|
|
223
|
+
...(configOverrides.build?.lib || {})
|
|
224
|
+
},
|
|
225
|
+
rollupOptions: {
|
|
226
|
+
external: allExternals,
|
|
227
|
+
output: {
|
|
228
|
+
globals,
|
|
229
|
+
},
|
|
230
|
+
...(configOverrides.build?.rollupOptions || {})
|
|
231
|
+
},
|
|
232
|
+
// Preserve class names and function names in minified output
|
|
233
|
+
minify: "terser",
|
|
234
|
+
terserOptions: {
|
|
235
|
+
keep_classnames: true,
|
|
236
|
+
mangle: {
|
|
237
|
+
keep_classnames: true,
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
sourcemap: true,
|
|
241
|
+
...(configOverrides.build ? Object.fromEntries(Object.entries(configOverrides.build).filter(([key]) => key !== "lib" && key !== "rollupOptions")) : {})
|
|
242
|
+
},
|
|
243
|
+
resolve: {
|
|
244
|
+
alias,
|
|
245
|
+
...(configOverrides.resolve || {})
|
|
246
|
+
},
|
|
247
|
+
esbuild: {
|
|
248
|
+
keepNames: true,
|
|
249
|
+
...(configOverrides.esbuild || {})
|
|
250
|
+
},
|
|
251
|
+
plugins: allPlugins,
|
|
252
|
+
test: {
|
|
253
|
+
projects: [nodeConfig, browserConfig],
|
|
254
|
+
...(configOverrides.test || {})
|
|
255
|
+
},
|
|
256
|
+
...Object.fromEntries(Object.entries(configOverrides).filter(([key]) => !["build", "resolve", "esbuild", "plugins"].includes(key)))
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
return defineConfig(config);
|
|
260
260
|
}
|