chore(build): enable Rspack runtime for Rslib builds - #1854
Conversation
Rsdoctor Bundle Diff AnalysisFound 13 projects in monorepo, 8 projects with changes. 📊 Quick Summary
📋 Detailed Reports (Click to expand)📁 browserPath:
📦 Download Diff Report: browser Bundle Diff 📁 adapter-rspackPath:
📦 Download Diff Report: adapter-rspack Bundle Diff 📁 coverage-v8Path:
📦 Download Diff Report: coverage-v8 Bundle Diff 📁 coverage-istanbulPath:
📦 Download Diff Report: coverage-istanbul Bundle Diff 📁 core/browserPath:
📦 Download Diff Report: core/browser Bundle Diff 📁 core/mainPath:
📦 Download Diff Report: core/main Bundle Diff 📁 vscode/extensionPath:
📦 Download Diff Report: vscode/extension Bundle Diff 📁 vscode/workerPath:
📦 Download Diff Report: vscode/worker Bundle Diff Generated by Rsdoctor GitHub Action |
|
A minimal reproduction is confirmed in Rspack Playground (Rspack v2.2.5). The reproduction uses the Rslib-style output shape: multiple entries, ESM library output, a named runtime chunk, and The relevant source is: export function getCommonJsSyntheticModule(exports) {
const exportNames = Object.getOwnPropertyNames(exports);
const namespace =
exports !== null &&
(typeof exports === 'object' || typeof exports === 'function')
? Object.defineProperties(
{},
Object.fromEntries(
exportNames.map((name) => [
name,
{
enumerable: true,
get() {
return exports[name];
},
},
]),
),
)
: { default: exports };
return namespace;
}
const namespace = getCommonJsSyntheticModule({ hiddenReceiverValue: 42 });
console.log('namespace keys:', Object.keys(namespace));
if (!Object.hasOwn(namespace, 'hiddenReceiverValue')) {
throw new Error('missing named export: hiddenReceiverValue');
}The generated function getCommonJsSyntheticModule(__nested_rspack_exports__) {
const namespace =
__nested_rspack_exports__ !== null &&
(typeof exports === 'object' || typeof exports === 'function')
? ...
: { default: __nested_rspack_exports__ };
}Since the output is ESM, Renaming the source parameter to |
Motivation
Enable Rspack's runtime output for the packages built with Rslib and verify the updated Rslib toolchain.
Changes
@rslib/corefrom 1.0.0 to 1.0.1 across Rslib build workspaces.experiments.runtimeMode: 'rspack'.Rspack documents
runtimeMode: 'rspack'as experimental: https://rspack.rs/zh/config/experiments#experimentsruntimemodeValidation: all Rslib builds passed; adapter/core targeted tests, in-source CLI E2E, typecheck, Knip, format/spell, and dependency-version checks passed.