@meteorjs/rspack 0.0.57 → 0.0.59
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/package.json +1 -1
- package/rspack.config.js +30 -12
package/package.json
CHANGED
package/rspack.config.js
CHANGED
|
@@ -361,9 +361,20 @@ module.exports = async function (inMeteor = {}, argv = {}) {
|
|
|
361
361
|
entry: path.resolve(process.cwd(), buildContext, entryPath),
|
|
362
362
|
output: {
|
|
363
363
|
path: clientOutputDir,
|
|
364
|
-
filename: () =>
|
|
365
|
-
|
|
366
|
-
|
|
364
|
+
filename: (_module) => {
|
|
365
|
+
const chunkName = _module.chunk?.name;
|
|
366
|
+
const isMainChunk = !chunkName || chunkName === "main";
|
|
367
|
+
const chunkSuffix = `${chunksContext}/[id]${
|
|
368
|
+
isProd ? '.[chunkhash]' : ''
|
|
369
|
+
}.js`;
|
|
370
|
+
if (isDevEnvironment) {
|
|
371
|
+
if (isMainChunk) return outputFilename;
|
|
372
|
+
return chunkSuffix;
|
|
373
|
+
}
|
|
374
|
+
if (isMainChunk) return `../${buildContext}/${outputPath}`;
|
|
375
|
+
return chunkSuffix;
|
|
376
|
+
},
|
|
377
|
+
libraryTarget: 'commonjs2',
|
|
367
378
|
publicPath: '/',
|
|
368
379
|
chunkFilename: `${chunksContext}/[id]${isProd ? '.[chunkhash]' : ''}.js`,
|
|
369
380
|
assetModuleFilename: `${assetsContext}/[hash][ext][query]`,
|
|
@@ -464,12 +475,16 @@ module.exports = async function (inMeteor = {}, argv = {}) {
|
|
|
464
475
|
output: {
|
|
465
476
|
path: serverOutputDir,
|
|
466
477
|
filename: () => `../${buildContext}/${outputPath}`,
|
|
467
|
-
libraryTarget: '
|
|
478
|
+
libraryTarget: 'commonjs2',
|
|
468
479
|
chunkFilename: `${chunksContext}/[id]${isProd ? '.[chunkhash]' : ''}.js`,
|
|
469
480
|
assetModuleFilename: `${assetsContext}/[hash][ext][query]`,
|
|
470
481
|
...(isProd && { clean: { keep: keepOutsideBuild() } }),
|
|
471
482
|
},
|
|
472
|
-
optimization: {
|
|
483
|
+
optimization: {
|
|
484
|
+
usedExports: true,
|
|
485
|
+
splitChunks: false,
|
|
486
|
+
runtimeChunk: false,
|
|
487
|
+
},
|
|
473
488
|
module: {
|
|
474
489
|
rules: [swcConfigRule, ...extraRules],
|
|
475
490
|
parser: {
|
|
@@ -552,13 +567,16 @@ module.exports = async function (inMeteor = {}, argv = {}) {
|
|
|
552
567
|
: projectConfig;
|
|
553
568
|
|
|
554
569
|
const omitPaths = [
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
570
|
+
"name",
|
|
571
|
+
"target",
|
|
572
|
+
"entry",
|
|
573
|
+
"output.path",
|
|
574
|
+
"output.filename",
|
|
575
|
+
"output.publicPath",
|
|
576
|
+
...(Meteor.isServer
|
|
577
|
+
? ["optimization.splitChunks", "optimization.runtimeChunk"]
|
|
578
|
+
: []),
|
|
579
|
+
].filter(Boolean);
|
|
562
580
|
const warningFn = path => {
|
|
563
581
|
console.warn(
|
|
564
582
|
`[rspack.config.js] Ignored custom "${path}" — reserved for Meteor-Rspack integration.`,
|