@meteorjs/rspack 3.0.0-beta.3 → 3.0.0-beta.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.
|
@@ -77,7 +77,7 @@ function extractLocalDependencies(configFilePath) {
|
|
|
77
77
|
// Remove duplicates
|
|
78
78
|
return [...new Set(dependencies)];
|
|
79
79
|
} catch (error) {
|
|
80
|
-
console.warn('[Rspack Cache] Failed to parse config dependencies:', error
|
|
80
|
+
console.warn('[Rspack Cache] Failed to parse config dependencies:', error);
|
|
81
81
|
return [];
|
|
82
82
|
}
|
|
83
83
|
}
|
package/package.json
CHANGED
|
@@ -69,6 +69,26 @@ class RequireExternalsPlugin {
|
|
|
69
69
|
this._funcCount = this._computeNextFuncCount();
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
// The *-meteor.js entry's parent dir can transiently vanish during an HMR rebuild
|
|
73
|
+
// (a server-restart reinitialises the build paths) — a bare writeFileSync then throws
|
|
74
|
+
// ENOENT and stalls the dev build ("Could not resolve meteor.mainModule …"). Ensure the
|
|
75
|
+
// dir exists before writing, and never let a transient race crash the build; the next
|
|
76
|
+
// rebuild regenerates the file.
|
|
77
|
+
_safeWrite(data) {
|
|
78
|
+
try {
|
|
79
|
+
fs.mkdirSync(path.dirname(this.filePath), { recursive: true });
|
|
80
|
+
fs.writeFileSync(this.filePath, data, 'utf-8');
|
|
81
|
+
} catch (err) {
|
|
82
|
+
if (err && err.code === 'ENOENT') {
|
|
83
|
+
// Transient: the build dir was reinitialised mid-rebuild. Don't crash — the next
|
|
84
|
+
// compile regenerates the file. Warn so the skip is visible when diagnosing HMR.
|
|
85
|
+
console.warn(`[meteor-rspack] skipped a transient ENOENT writing ${this.filePath}; the next rebuild will regenerate it`);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
throw err;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
72
92
|
// Helper method to check if a module name matches the externals or default prefix
|
|
73
93
|
_isExternalModule(name) {
|
|
74
94
|
if (typeof name !== 'string') return false;
|
|
@@ -243,7 +263,7 @@ class RequireExternalsPlugin {
|
|
|
243
263
|
content = content.replace(emptyLastFnRe, '');
|
|
244
264
|
|
|
245
265
|
// Write the cleaned file back
|
|
246
|
-
|
|
266
|
+
this._safeWrite(content);
|
|
247
267
|
|
|
248
268
|
// Re-populate `existing` so the add-diff is accurate
|
|
249
269
|
existing.clear();
|
|
@@ -372,9 +392,9 @@ class RequireExternalsPlugin {
|
|
|
372
392
|
if (existingLastImports.length > 0) {
|
|
373
393
|
const body = existingLastImports.join('\n');
|
|
374
394
|
const fnCode = `\n// (function lastImports() {\n${body}\n// })\n`;
|
|
375
|
-
|
|
395
|
+
this._safeWrite(content + fnCode);
|
|
376
396
|
} else {
|
|
377
|
-
|
|
397
|
+
this._safeWrite(content);
|
|
378
398
|
}
|
|
379
399
|
}
|
|
380
400
|
// If lastImports don't exist, add them if needed
|
|
@@ -443,7 +463,7 @@ class RequireExternalsPlugin {
|
|
|
443
463
|
`// (function lastImports() {\n${newBody}// })`
|
|
444
464
|
);
|
|
445
465
|
|
|
446
|
-
|
|
466
|
+
this._safeWrite(updatedContent);
|
|
447
467
|
}
|
|
448
468
|
}
|
|
449
469
|
});
|
|
@@ -510,11 +530,11 @@ class RequireExternalsPlugin {
|
|
|
510
530
|
content = fs.readFileSync(this.filePath, 'utf-8');
|
|
511
531
|
if (!content.includes(`typeof globalThis.module === 'undefined'`)) {
|
|
512
532
|
// Prepend so it lives at the very top
|
|
513
|
-
|
|
533
|
+
this._safeWrite(block + '\n' + content);
|
|
514
534
|
}
|
|
515
535
|
} else {
|
|
516
536
|
// File doesn’t exist yet: create with just the block
|
|
517
|
-
|
|
537
|
+
this._safeWrite(block);
|
|
518
538
|
}
|
|
519
539
|
}
|
|
520
540
|
|
package/rspack.config.js
CHANGED
|
@@ -134,7 +134,7 @@ function createSwcConfig({
|
|
|
134
134
|
...(isJsxEnabled && { jsx: true }),
|
|
135
135
|
...(isAngularEnabled && { decorators: true }),
|
|
136
136
|
},
|
|
137
|
-
target: isLegacy ? 'es5' : isClient ? 'es2015' : '
|
|
137
|
+
target: isLegacy ? 'es5' : isClient ? 'es2015' : 'es2024',
|
|
138
138
|
...(isReactEnabled && {
|
|
139
139
|
transform: {
|
|
140
140
|
react: {
|