@rsbuild/webpack 0.7.8 → 0.7.10
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/dist/index.cjs +49 -37
- package/dist/index.js +41 -37
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -39,7 +39,7 @@ var __publicField = (obj, key, value) => {
|
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
// src/shared.ts
|
|
42
|
-
var import_core, getChainUtils, initRsbuildConfig, createDevServer, formatStats, getDevMiddleware, getStatsOptions, stringifyConfig, outputInspectConfigFiles;
|
|
42
|
+
var import_core, getChainUtils, initRsbuildConfig, createDevServer, formatStats, getDevMiddleware, getStatsOptions, stringifyConfig, outputInspectConfigFiles, chainToConfig, modifyBundlerChain, onCompileDone, TARGET_ID_MAP;
|
|
43
43
|
var init_shared = __esm({
|
|
44
44
|
"src/shared.ts"() {
|
|
45
45
|
"use strict";
|
|
@@ -52,7 +52,11 @@ var init_shared = __esm({
|
|
|
52
52
|
getDevMiddleware,
|
|
53
53
|
getStatsOptions,
|
|
54
54
|
stringifyConfig,
|
|
55
|
-
outputInspectConfigFiles
|
|
55
|
+
outputInspectConfigFiles,
|
|
56
|
+
chainToConfig,
|
|
57
|
+
modifyBundlerChain,
|
|
58
|
+
onCompileDone,
|
|
59
|
+
TARGET_ID_MAP
|
|
56
60
|
} = import_core.__internalHelper);
|
|
57
61
|
}
|
|
58
62
|
});
|
|
@@ -130,7 +134,7 @@ var init_inspectConfig = __esm({
|
|
|
130
134
|
|
|
131
135
|
// src/webpackConfig.ts
|
|
132
136
|
async function modifyWebpackChain(context, utils, chain) {
|
|
133
|
-
|
|
137
|
+
import_core2.logger.debug("modify webpack chain");
|
|
134
138
|
const [modifiedChain] = await context.hooks.modifyWebpackChain.call(
|
|
135
139
|
chain,
|
|
136
140
|
utils
|
|
@@ -140,11 +144,11 @@ async function modifyWebpackChain(context, utils, chain) {
|
|
|
140
144
|
item(modifiedChain, utils);
|
|
141
145
|
}
|
|
142
146
|
}
|
|
143
|
-
|
|
147
|
+
import_core2.logger.debug("modify webpack chain done");
|
|
144
148
|
return modifiedChain;
|
|
145
149
|
}
|
|
146
150
|
async function modifyWebpackConfig(context, webpackConfig, utils) {
|
|
147
|
-
|
|
151
|
+
import_core2.logger.debug("modify webpack config");
|
|
148
152
|
let [modifiedConfig] = await context.hooks.modifyWebpackConfig.call(
|
|
149
153
|
webpackConfig,
|
|
150
154
|
utils
|
|
@@ -157,7 +161,7 @@ async function modifyWebpackConfig(context, webpackConfig, utils) {
|
|
|
157
161
|
mergeFn: utils.mergeConfig
|
|
158
162
|
});
|
|
159
163
|
}
|
|
160
|
-
|
|
164
|
+
import_core2.logger.debug("modify webpack config done");
|
|
161
165
|
return modifiedConfig;
|
|
162
166
|
}
|
|
163
167
|
async function getChainUtils2(target) {
|
|
@@ -226,7 +230,7 @@ async function generateWebpackConfig({
|
|
|
226
230
|
ProvidePlugin,
|
|
227
231
|
HotModuleReplacementPlugin
|
|
228
232
|
} = webpack2;
|
|
229
|
-
const bundlerChain = await
|
|
233
|
+
const bundlerChain = await modifyBundlerChain(context, {
|
|
230
234
|
...chainUtils,
|
|
231
235
|
bundler: {
|
|
232
236
|
BannerPlugin,
|
|
@@ -237,7 +241,7 @@ async function generateWebpackConfig({
|
|
|
237
241
|
}
|
|
238
242
|
});
|
|
239
243
|
const chain = await modifyWebpackChain(context, chainUtils, bundlerChain);
|
|
240
|
-
let webpackConfig =
|
|
244
|
+
let webpackConfig = chainToConfig(chain);
|
|
241
245
|
webpackConfig = await modifyWebpackConfig(
|
|
242
246
|
context,
|
|
243
247
|
webpackConfig,
|
|
@@ -269,7 +273,7 @@ async function initConfigs({
|
|
|
269
273
|
const webpackConfigs = await Promise.all(
|
|
270
274
|
targets.map((target) => generateWebpackConfig({ target, context }))
|
|
271
275
|
);
|
|
272
|
-
if (
|
|
276
|
+
if (import_core3.logger.level === "verbose") {
|
|
273
277
|
const inspect = () => {
|
|
274
278
|
const inspectOptions = {
|
|
275
279
|
verbose: true,
|
|
@@ -290,11 +294,11 @@ async function initConfigs({
|
|
|
290
294
|
webpackConfigs
|
|
291
295
|
};
|
|
292
296
|
}
|
|
293
|
-
var
|
|
297
|
+
var import_core3;
|
|
294
298
|
var init_initConfigs = __esm({
|
|
295
299
|
"src/initConfigs.ts"() {
|
|
296
300
|
"use strict";
|
|
297
|
-
|
|
301
|
+
import_core3 = require("@rsbuild/core");
|
|
298
302
|
init_inspectConfig();
|
|
299
303
|
init_shared();
|
|
300
304
|
init_webpackConfig();
|
|
@@ -311,7 +315,7 @@ async function createCompiler({
|
|
|
311
315
|
context,
|
|
312
316
|
webpackConfigs
|
|
313
317
|
}) {
|
|
314
|
-
|
|
318
|
+
import_core4.logger.debug("create compiler");
|
|
315
319
|
await context.hooks.onBeforeCreateCompiler.call({
|
|
316
320
|
bundlerConfigs: webpackConfigs
|
|
317
321
|
});
|
|
@@ -323,12 +327,12 @@ async function createCompiler({
|
|
|
323
327
|
getStatsOptions(compiler)
|
|
324
328
|
);
|
|
325
329
|
if (level === "error") {
|
|
326
|
-
|
|
330
|
+
import_core4.logger.error(message);
|
|
327
331
|
}
|
|
328
332
|
if (level === "warning") {
|
|
329
|
-
|
|
333
|
+
import_core4.logger.warn(message);
|
|
330
334
|
}
|
|
331
|
-
if ((0,
|
|
335
|
+
if ((0, import_shared6.isDev)()) {
|
|
332
336
|
await context.hooks.onDevCompileDone.call({
|
|
333
337
|
isFirstCompile,
|
|
334
338
|
stats
|
|
@@ -337,11 +341,11 @@ async function createCompiler({
|
|
|
337
341
|
isFirstCompile = false;
|
|
338
342
|
};
|
|
339
343
|
let isFirstCompile = true;
|
|
340
|
-
|
|
344
|
+
onCompileDone(compiler, done, import_MultiStats.default);
|
|
341
345
|
await context.hooks.onAfterCreateCompiler.call({
|
|
342
346
|
compiler
|
|
343
347
|
});
|
|
344
|
-
|
|
348
|
+
import_core4.logger.debug("create compiler done");
|
|
345
349
|
return compiler;
|
|
346
350
|
}
|
|
347
351
|
async function createDevMiddleware(options, customCompiler) {
|
|
@@ -360,15 +364,16 @@ async function createDevMiddleware(options, customCompiler) {
|
|
|
360
364
|
compiler
|
|
361
365
|
};
|
|
362
366
|
}
|
|
363
|
-
var
|
|
367
|
+
var import_core4, import_shared6, import_MultiStats;
|
|
364
368
|
var init_createCompiler = __esm({
|
|
365
369
|
"src/createCompiler.ts"() {
|
|
366
370
|
"use strict";
|
|
367
|
-
|
|
368
|
-
|
|
371
|
+
import_core4 = require("@rsbuild/core");
|
|
372
|
+
import_shared6 = require("@rsbuild/shared");
|
|
369
373
|
import_MultiStats = __toESM(require("webpack/lib/MultiStats.js"));
|
|
370
374
|
init_initConfigs();
|
|
371
375
|
init_shared();
|
|
376
|
+
init_shared();
|
|
372
377
|
}
|
|
373
378
|
});
|
|
374
379
|
|
|
@@ -2229,24 +2234,24 @@ function createNonTTYLogger() {
|
|
|
2229
2234
|
}
|
|
2230
2235
|
prevPercentage = 100;
|
|
2231
2236
|
if (hasErrors) {
|
|
2232
|
-
|
|
2237
|
+
import_core5.logger.error(`${id} compile failed in ${compileTime}`);
|
|
2233
2238
|
} else {
|
|
2234
|
-
|
|
2239
|
+
import_core5.logger.ready(`${id} compiled in ${compileTime}`);
|
|
2235
2240
|
}
|
|
2236
2241
|
} else if (current - prevPercentage > 10) {
|
|
2237
2242
|
prevPercentage = current;
|
|
2238
|
-
|
|
2243
|
+
import_core5.logger.info(`${id} compile progress: ${current.toFixed(0)}%`);
|
|
2239
2244
|
}
|
|
2240
2245
|
};
|
|
2241
2246
|
return {
|
|
2242
2247
|
log
|
|
2243
2248
|
};
|
|
2244
2249
|
}
|
|
2245
|
-
var
|
|
2250
|
+
var import_core5;
|
|
2246
2251
|
var init_nonTty = __esm({
|
|
2247
2252
|
"src/progress/helpers/nonTty.ts"() {
|
|
2248
2253
|
"use strict";
|
|
2249
|
-
|
|
2254
|
+
import_core5 = require("@rsbuild/core");
|
|
2250
2255
|
}
|
|
2251
2256
|
});
|
|
2252
2257
|
|
|
@@ -2255,10 +2260,11 @@ var ProgressPlugin_exports = {};
|
|
|
2255
2260
|
__export(ProgressPlugin_exports, {
|
|
2256
2261
|
ProgressPlugin: () => ProgressPlugin
|
|
2257
2262
|
});
|
|
2258
|
-
var import_shared10, import_webpack, ProgressPlugin;
|
|
2263
|
+
var import_core6, import_shared10, import_webpack, ProgressPlugin;
|
|
2259
2264
|
var init_ProgressPlugin = __esm({
|
|
2260
2265
|
"src/progress/ProgressPlugin.ts"() {
|
|
2261
2266
|
"use strict";
|
|
2267
|
+
import_core6 = require("@rsbuild/core");
|
|
2262
2268
|
import_shared10 = require("@rsbuild/shared");
|
|
2263
2269
|
import_webpack = __toESM(require("webpack"));
|
|
2264
2270
|
init_helpers();
|
|
@@ -2321,7 +2327,7 @@ var init_ProgressPlugin = __esm({
|
|
|
2321
2327
|
this.compileTime = (0, import_shared10.prettyTime)(seconds);
|
|
2322
2328
|
startTime = null;
|
|
2323
2329
|
if (!this.hasCompileErrors) {
|
|
2324
|
-
|
|
2330
|
+
import_core6.logger.ready(`${this.id} compiled in ${this.compileTime}`);
|
|
2325
2331
|
}
|
|
2326
2332
|
}
|
|
2327
2333
|
});
|
|
@@ -2352,18 +2358,23 @@ async function applyTsConfigPathsPlugin({
|
|
|
2352
2358
|
}
|
|
2353
2359
|
]);
|
|
2354
2360
|
}
|
|
2361
|
+
function isWebTarget(target) {
|
|
2362
|
+
const targets = (0, import_shared11.castArray)(target);
|
|
2363
|
+
return targets.includes("web") || target.includes("web-worker");
|
|
2364
|
+
}
|
|
2355
2365
|
var import_node_fs, import_shared11, getMainFields, pluginAdaptor;
|
|
2356
2366
|
var init_plugin = __esm({
|
|
2357
2367
|
"src/plugin.ts"() {
|
|
2358
2368
|
"use strict";
|
|
2359
2369
|
import_node_fs = __toESM(require("fs"));
|
|
2360
2370
|
import_shared11 = require("@rsbuild/shared");
|
|
2371
|
+
init_shared();
|
|
2361
2372
|
getMainFields = (chain, target) => {
|
|
2362
2373
|
const mainFields = chain.resolve.mainFields.values();
|
|
2363
2374
|
if (mainFields.length) {
|
|
2364
2375
|
return mainFields;
|
|
2365
2376
|
}
|
|
2366
|
-
if (
|
|
2377
|
+
if (isWebTarget(target)) {
|
|
2367
2378
|
return ["browser", "module", "main"];
|
|
2368
2379
|
}
|
|
2369
2380
|
return ["module", "main"];
|
|
@@ -2387,7 +2398,7 @@ var init_plugin = __esm({
|
|
|
2387
2398
|
const { ProgressPlugin: ProgressPlugin2 } = await Promise.resolve().then(() => (init_ProgressPlugin(), ProgressPlugin_exports));
|
|
2388
2399
|
chain.plugin(CHAIN_ID.PLUGIN.PROGRESS).use(ProgressPlugin2, [
|
|
2389
2400
|
{
|
|
2390
|
-
id:
|
|
2401
|
+
id: TARGET_ID_MAP[target],
|
|
2391
2402
|
...progress === true ? {} : progress
|
|
2392
2403
|
}
|
|
2393
2404
|
]);
|
|
@@ -2427,18 +2438,19 @@ var build_exports = {};
|
|
|
2427
2438
|
__export(build_exports, {
|
|
2428
2439
|
build: () => build
|
|
2429
2440
|
});
|
|
2430
|
-
var
|
|
2441
|
+
var import_core7, import_shared13, import_MultiStats2, build;
|
|
2431
2442
|
var init_build = __esm({
|
|
2432
2443
|
"src/build.ts"() {
|
|
2433
2444
|
"use strict";
|
|
2434
|
-
|
|
2435
|
-
|
|
2445
|
+
import_core7 = require("@rsbuild/core");
|
|
2446
|
+
import_shared13 = require("@rsbuild/shared");
|
|
2436
2447
|
import_MultiStats2 = __toESM(require("webpack/lib/MultiStats.js"));
|
|
2437
2448
|
init_createCompiler();
|
|
2438
2449
|
init_initConfigs();
|
|
2450
|
+
init_shared();
|
|
2439
2451
|
build = async (initOptions, { mode = "production", watch, compiler: customCompiler } = {}) => {
|
|
2440
|
-
if (!(0,
|
|
2441
|
-
(0,
|
|
2452
|
+
if (!(0, import_shared13.getNodeEnv)()) {
|
|
2453
|
+
(0, import_shared13.setNodeEnv)(mode);
|
|
2442
2454
|
}
|
|
2443
2455
|
const { context } = initOptions;
|
|
2444
2456
|
let compiler;
|
|
@@ -2462,11 +2474,11 @@ var init_build = __esm({
|
|
|
2462
2474
|
isFirstCompile = false;
|
|
2463
2475
|
await p;
|
|
2464
2476
|
};
|
|
2465
|
-
|
|
2477
|
+
onCompileDone(compiler, onDone, import_MultiStats2.default);
|
|
2466
2478
|
if (watch) {
|
|
2467
2479
|
compiler.watch({}, (err) => {
|
|
2468
2480
|
if (err) {
|
|
2469
|
-
|
|
2481
|
+
import_core7.logger.error(err);
|
|
2470
2482
|
}
|
|
2471
2483
|
});
|
|
2472
2484
|
return;
|
|
@@ -2478,7 +2490,7 @@ var init_build = __esm({
|
|
|
2478
2490
|
reject(buildError);
|
|
2479
2491
|
} else {
|
|
2480
2492
|
compiler.close((closeErr) => {
|
|
2481
|
-
closeErr &&
|
|
2493
|
+
closeErr && import_core7.logger.error(closeErr);
|
|
2482
2494
|
resolve({ stats });
|
|
2483
2495
|
});
|
|
2484
2496
|
}
|
package/dist/index.js
CHANGED
|
@@ -57,7 +57,7 @@ var init_esm = __esm({
|
|
|
57
57
|
|
|
58
58
|
// src/shared.ts
|
|
59
59
|
import { __internalHelper } from "@rsbuild/core";
|
|
60
|
-
var getChainUtils, initRsbuildConfig, createDevServer, formatStats, getDevMiddleware, getStatsOptions, stringifyConfig, outputInspectConfigFiles;
|
|
60
|
+
var getChainUtils, initRsbuildConfig, createDevServer, formatStats, getDevMiddleware, getStatsOptions, stringifyConfig, outputInspectConfigFiles, chainToConfig, modifyBundlerChain, onCompileDone, TARGET_ID_MAP;
|
|
61
61
|
var init_shared = __esm({
|
|
62
62
|
"src/shared.ts"() {
|
|
63
63
|
"use strict";
|
|
@@ -70,7 +70,11 @@ var init_shared = __esm({
|
|
|
70
70
|
getDevMiddleware,
|
|
71
71
|
getStatsOptions,
|
|
72
72
|
stringifyConfig,
|
|
73
|
-
outputInspectConfigFiles
|
|
73
|
+
outputInspectConfigFiles,
|
|
74
|
+
chainToConfig,
|
|
75
|
+
modifyBundlerChain,
|
|
76
|
+
onCompileDone,
|
|
77
|
+
TARGET_ID_MAP
|
|
74
78
|
} = __internalHelper);
|
|
75
79
|
}
|
|
76
80
|
});
|
|
@@ -148,17 +152,15 @@ var init_inspectConfig = __esm({
|
|
|
148
152
|
|
|
149
153
|
// src/webpackConfig.ts
|
|
150
154
|
import {
|
|
151
|
-
__internalHelper as __internalHelper2
|
|
155
|
+
__internalHelper as __internalHelper2,
|
|
156
|
+
logger
|
|
152
157
|
} from "@rsbuild/core";
|
|
153
158
|
import {
|
|
154
159
|
castArray,
|
|
155
|
-
chainToConfig,
|
|
156
|
-
debug,
|
|
157
|
-
modifyBundlerChain,
|
|
158
160
|
reduceConfigsWithContext
|
|
159
161
|
} from "@rsbuild/shared";
|
|
160
162
|
async function modifyWebpackChain(context, utils, chain) {
|
|
161
|
-
debug("modify webpack chain");
|
|
163
|
+
logger.debug("modify webpack chain");
|
|
162
164
|
const [modifiedChain] = await context.hooks.modifyWebpackChain.call(
|
|
163
165
|
chain,
|
|
164
166
|
utils
|
|
@@ -168,11 +170,11 @@ async function modifyWebpackChain(context, utils, chain) {
|
|
|
168
170
|
item(modifiedChain, utils);
|
|
169
171
|
}
|
|
170
172
|
}
|
|
171
|
-
debug("modify webpack chain done");
|
|
173
|
+
logger.debug("modify webpack chain done");
|
|
172
174
|
return modifiedChain;
|
|
173
175
|
}
|
|
174
176
|
async function modifyWebpackConfig(context, webpackConfig, utils) {
|
|
175
|
-
debug("modify webpack config");
|
|
177
|
+
logger.debug("modify webpack config");
|
|
176
178
|
let [modifiedConfig] = await context.hooks.modifyWebpackConfig.call(
|
|
177
179
|
webpackConfig,
|
|
178
180
|
utils
|
|
@@ -185,7 +187,7 @@ async function modifyWebpackConfig(context, webpackConfig, utils) {
|
|
|
185
187
|
mergeFn: utils.mergeConfig
|
|
186
188
|
});
|
|
187
189
|
}
|
|
188
|
-
debug("modify webpack config done");
|
|
190
|
+
logger.debug("modify webpack config done");
|
|
189
191
|
return modifiedConfig;
|
|
190
192
|
}
|
|
191
193
|
async function getChainUtils2(target) {
|
|
@@ -282,7 +284,9 @@ var init_webpackConfig = __esm({
|
|
|
282
284
|
});
|
|
283
285
|
|
|
284
286
|
// src/initConfigs.ts
|
|
285
|
-
import {
|
|
287
|
+
import {
|
|
288
|
+
logger as logger2
|
|
289
|
+
} from "@rsbuild/core";
|
|
286
290
|
async function initConfigs({
|
|
287
291
|
context,
|
|
288
292
|
pluginManager,
|
|
@@ -296,7 +300,7 @@ async function initConfigs({
|
|
|
296
300
|
const webpackConfigs = await Promise.all(
|
|
297
301
|
targets.map((target) => generateWebpackConfig({ target, context }))
|
|
298
302
|
);
|
|
299
|
-
if (
|
|
303
|
+
if (logger2.level === "verbose") {
|
|
300
304
|
const inspect = () => {
|
|
301
305
|
const inspectOptions = {
|
|
302
306
|
verbose: true,
|
|
@@ -333,18 +337,14 @@ __export(createCompiler_exports, {
|
|
|
333
337
|
createCompiler: () => createCompiler,
|
|
334
338
|
createDevMiddleware: () => createDevMiddleware
|
|
335
339
|
});
|
|
336
|
-
import { logger } from "@rsbuild/core";
|
|
337
|
-
import {
|
|
338
|
-
debug as debug2,
|
|
339
|
-
isDev,
|
|
340
|
-
onCompileDone
|
|
341
|
-
} from "@rsbuild/shared";
|
|
340
|
+
import { logger as logger3 } from "@rsbuild/core";
|
|
341
|
+
import { isDev } from "@rsbuild/shared";
|
|
342
342
|
import WebpackMultiStats from "webpack/lib/MultiStats.js";
|
|
343
343
|
async function createCompiler({
|
|
344
344
|
context,
|
|
345
345
|
webpackConfigs
|
|
346
346
|
}) {
|
|
347
|
-
|
|
347
|
+
logger3.debug("create compiler");
|
|
348
348
|
await context.hooks.onBeforeCreateCompiler.call({
|
|
349
349
|
bundlerConfigs: webpackConfigs
|
|
350
350
|
});
|
|
@@ -356,10 +356,10 @@ async function createCompiler({
|
|
|
356
356
|
getStatsOptions(compiler)
|
|
357
357
|
);
|
|
358
358
|
if (level === "error") {
|
|
359
|
-
|
|
359
|
+
logger3.error(message);
|
|
360
360
|
}
|
|
361
361
|
if (level === "warning") {
|
|
362
|
-
|
|
362
|
+
logger3.warn(message);
|
|
363
363
|
}
|
|
364
364
|
if (isDev()) {
|
|
365
365
|
await context.hooks.onDevCompileDone.call({
|
|
@@ -374,7 +374,7 @@ async function createCompiler({
|
|
|
374
374
|
await context.hooks.onAfterCreateCompiler.call({
|
|
375
375
|
compiler
|
|
376
376
|
});
|
|
377
|
-
|
|
377
|
+
logger3.debug("create compiler done");
|
|
378
378
|
return compiler;
|
|
379
379
|
}
|
|
380
380
|
async function createDevMiddleware(options, customCompiler) {
|
|
@@ -399,6 +399,7 @@ var init_createCompiler = __esm({
|
|
|
399
399
|
init_esm();
|
|
400
400
|
init_initConfigs();
|
|
401
401
|
init_shared();
|
|
402
|
+
init_shared();
|
|
402
403
|
}
|
|
403
404
|
});
|
|
404
405
|
|
|
@@ -2266,7 +2267,7 @@ var init_helpers = __esm({
|
|
|
2266
2267
|
});
|
|
2267
2268
|
|
|
2268
2269
|
// src/progress/helpers/nonTty.ts
|
|
2269
|
-
import { logger as
|
|
2270
|
+
import { logger as logger4 } from "@rsbuild/core";
|
|
2270
2271
|
function createNonTTYLogger() {
|
|
2271
2272
|
let prevPercentage = 0;
|
|
2272
2273
|
const log = ({
|
|
@@ -2282,13 +2283,13 @@ function createNonTTYLogger() {
|
|
|
2282
2283
|
}
|
|
2283
2284
|
prevPercentage = 100;
|
|
2284
2285
|
if (hasErrors) {
|
|
2285
|
-
|
|
2286
|
+
logger4.error(`${id} compile failed in ${compileTime}`);
|
|
2286
2287
|
} else {
|
|
2287
|
-
|
|
2288
|
+
logger4.ready(`${id} compiled in ${compileTime}`);
|
|
2288
2289
|
}
|
|
2289
2290
|
} else if (current - prevPercentage > 10) {
|
|
2290
2291
|
prevPercentage = current;
|
|
2291
|
-
|
|
2292
|
+
logger4.info(`${id} compile progress: ${current.toFixed(0)}%`);
|
|
2292
2293
|
}
|
|
2293
2294
|
};
|
|
2294
2295
|
return {
|
|
@@ -2307,7 +2308,8 @@ var ProgressPlugin_exports = {};
|
|
|
2307
2308
|
__export(ProgressPlugin_exports, {
|
|
2308
2309
|
ProgressPlugin: () => ProgressPlugin
|
|
2309
2310
|
});
|
|
2310
|
-
import { logger as
|
|
2311
|
+
import { logger as logger5 } from "@rsbuild/core";
|
|
2312
|
+
import { prettyTime } from "@rsbuild/shared";
|
|
2311
2313
|
import webpack from "webpack";
|
|
2312
2314
|
var ProgressPlugin;
|
|
2313
2315
|
var init_ProgressPlugin = __esm({
|
|
@@ -2374,7 +2376,7 @@ var init_ProgressPlugin = __esm({
|
|
|
2374
2376
|
this.compileTime = prettyTime(seconds);
|
|
2375
2377
|
startTime = null;
|
|
2376
2378
|
if (!this.hasCompileErrors) {
|
|
2377
|
-
|
|
2379
|
+
logger5.ready(`${this.id} compiled in ${this.compileTime}`);
|
|
2378
2380
|
}
|
|
2379
2381
|
}
|
|
2380
2382
|
});
|
|
@@ -2389,10 +2391,7 @@ __export(plugin_exports, {
|
|
|
2389
2391
|
pluginAdaptor: () => pluginAdaptor
|
|
2390
2392
|
});
|
|
2391
2393
|
import fs from "fs";
|
|
2392
|
-
import {
|
|
2393
|
-
TARGET_ID_MAP,
|
|
2394
|
-
isWebTarget
|
|
2395
|
-
} from "@rsbuild/shared";
|
|
2394
|
+
import { castArray as castArray2 } from "@rsbuild/shared";
|
|
2396
2395
|
async function applyTsConfigPathsPlugin({
|
|
2397
2396
|
chain,
|
|
2398
2397
|
CHAIN_ID,
|
|
@@ -2410,11 +2409,16 @@ async function applyTsConfigPathsPlugin({
|
|
|
2410
2409
|
}
|
|
2411
2410
|
]);
|
|
2412
2411
|
}
|
|
2412
|
+
function isWebTarget(target) {
|
|
2413
|
+
const targets = castArray2(target);
|
|
2414
|
+
return targets.includes("web") || target.includes("web-worker");
|
|
2415
|
+
}
|
|
2413
2416
|
var getMainFields, pluginAdaptor;
|
|
2414
2417
|
var init_plugin = __esm({
|
|
2415
2418
|
"src/plugin.ts"() {
|
|
2416
2419
|
"use strict";
|
|
2417
2420
|
init_esm();
|
|
2421
|
+
init_shared();
|
|
2418
2422
|
getMainFields = (chain, target) => {
|
|
2419
2423
|
const mainFields = chain.resolve.mainFields.values();
|
|
2420
2424
|
if (mainFields.length) {
|
|
@@ -2484,10 +2488,9 @@ var build_exports = {};
|
|
|
2484
2488
|
__export(build_exports, {
|
|
2485
2489
|
build: () => build
|
|
2486
2490
|
});
|
|
2487
|
-
import { logger as
|
|
2491
|
+
import { logger as logger6 } from "@rsbuild/core";
|
|
2488
2492
|
import {
|
|
2489
2493
|
getNodeEnv as getNodeEnv2,
|
|
2490
|
-
onCompileDone as onCompileDone2,
|
|
2491
2494
|
setNodeEnv as setNodeEnv2
|
|
2492
2495
|
} from "@rsbuild/shared";
|
|
2493
2496
|
import WebpackMultiStats2 from "webpack/lib/MultiStats.js";
|
|
@@ -2498,6 +2501,7 @@ var init_build = __esm({
|
|
|
2498
2501
|
init_esm();
|
|
2499
2502
|
init_createCompiler();
|
|
2500
2503
|
init_initConfigs();
|
|
2504
|
+
init_shared();
|
|
2501
2505
|
build = async (initOptions, { mode = "production", watch, compiler: customCompiler } = {}) => {
|
|
2502
2506
|
if (!getNodeEnv2()) {
|
|
2503
2507
|
setNodeEnv2(mode);
|
|
@@ -2524,11 +2528,11 @@ var init_build = __esm({
|
|
|
2524
2528
|
isFirstCompile = false;
|
|
2525
2529
|
await p;
|
|
2526
2530
|
};
|
|
2527
|
-
|
|
2531
|
+
onCompileDone(compiler, onDone, WebpackMultiStats2);
|
|
2528
2532
|
if (watch) {
|
|
2529
2533
|
compiler.watch({}, (err) => {
|
|
2530
2534
|
if (err) {
|
|
2531
|
-
|
|
2535
|
+
logger6.error(err);
|
|
2532
2536
|
}
|
|
2533
2537
|
});
|
|
2534
2538
|
return;
|
|
@@ -2540,7 +2544,7 @@ var init_build = __esm({
|
|
|
2540
2544
|
reject(buildError);
|
|
2541
2545
|
} else {
|
|
2542
2546
|
compiler.close((closeErr) => {
|
|
2543
|
-
closeErr &&
|
|
2547
|
+
closeErr && logger6.error(closeErr);
|
|
2544
2548
|
resolve({ stats });
|
|
2545
2549
|
});
|
|
2546
2550
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/webpack",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.10",
|
|
4
4
|
"homepage": "https://rsbuild.dev",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"mini-css-extract-plugin": "2.9.0",
|
|
28
28
|
"tsconfig-paths-webpack-plugin": "4.1.0",
|
|
29
29
|
"webpack": "^5.92.0",
|
|
30
|
-
"@rsbuild/core": "0.7.
|
|
31
|
-
"@rsbuild/shared": "0.7.
|
|
30
|
+
"@rsbuild/core": "0.7.10",
|
|
31
|
+
"@rsbuild/shared": "0.7.10"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/node": "18.x",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"cli-truncate": "2.1.0",
|
|
37
37
|
"patch-console": "1.0.0",
|
|
38
38
|
"typescript": "^5.4.2",
|
|
39
|
-
"@scripts/test-helper": "0.7.
|
|
39
|
+
"@scripts/test-helper": "0.7.10"
|
|
40
40
|
},
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public",
|