Skip to content

Commit 4a9344a

Browse files
authored
feat: runtime chunk name default to rslib-runtime (#1320)
1 parent 8ac3afb commit 4a9344a

File tree

5 files changed

+12
-6
lines changed

5 files changed

+12
-6
lines changed

packages/core/src/config.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,11 @@ const composeFormatConfig = ({
664664
// experimentalEsmOutput don't need concatenateModules
665665
concatenateModules: !experimentalEsmOutput,
666666
sideEffects: experimentalEsmOutput ? true : 'flag',
667-
runtimeChunk: experimentalEsmOutput ? 'single' : undefined,
667+
runtimeChunk: experimentalEsmOutput
668+
? {
669+
name: 'rslib-runtime',
670+
}
671+
: undefined,
668672
avoidEntryIife: true,
669673
splitChunks: {
670674
// Splitted "sync" chunks will make entry modules can't be inlined.

packages/core/tests/__snapshots__/config.test.ts.snap

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,9 @@ exports[`Should compose create Rsbuild config correctly > Enable experiment.adva
658658
nodeEnv: false,
659659
concatenateModules: false,
660660
sideEffects: true,
661-
runtimeChunk: 'single',
661+
runtimeChunk: {
662+
name: 'rslib-runtime'
663+
},
662664
avoidEntryIife: true
663665
},
664666
plugins: [

tests/integration/resolve/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ test('resolve false', async () => {
2121
expect(isSuccess).toBeTruthy();
2222
if (process.env.ADVANCED_ESM) {
2323
expect(entries.esm).toMatchInlineSnapshot(`
24-
"import { __webpack_require__ } from "./runtime.js";
24+
"import { __webpack_require__ } from "./rslib-runtime.js";
2525
__webpack_require__.add({
2626
"?b5d4": function() {}
2727
});

tests/integration/style/css-modules-named/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ test('should extract css-modules named export successfully in bundle', async ()
2020
`);
2121
if (process.env.ADVANCED_ESM) {
2222
expect(js.entries.esm).toMatchInlineSnapshot(`
23-
"import "./runtime.js";
23+
"import "./rslib-runtime.js";
2424
var _1 = "content-wrapper-iNtwbA";
2525
const src_button = _1;
2626
export { src_button as button };

tests/integration/vue/index.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ describe.runIf(platform() !== 'win32')('ESM', async () => {
1414
if (process.env.ADVANCED_ESM) {
1515
expect(js.contents.esm1).toMatchInlineSnapshot(`
1616
{
17-
"<ROOT>/tests/integration/vue/dist/bundle/index.js": "import "./runtime.js";
17+
"<ROOT>/tests/integration/vue/dist/bundle/index.js": "import "./rslib-runtime.js";
1818
import { createElementBlock, openBlock, ref, toDisplayString } from "vue";
1919
const _00_2Fplugin_vue_2Fexport_helper = (sfc, props)=>{
2020
const target = sfc.__vccOpts || sfc;
@@ -87,7 +87,7 @@ describe.runIf(platform() !== 'win32')('ESM', async () => {
8787
]);
8888
export { Button, Card };
8989
",
90-
"<ROOT>/tests/integration/vue/dist/bundle/runtime.js": "var __webpack_modules__ = {};
90+
"<ROOT>/tests/integration/vue/dist/bundle/rslib-runtime.js": "var __webpack_modules__ = {};
9191
var __webpack_module_cache__ = {};
9292
function __webpack_require__(moduleId) {
9393
var cachedModule = __webpack_module_cache__[moduleId];

0 commit comments

Comments
 (0)