Repository: web-infra-dev/rslib
Pull request #896: refactor: supersede entry query by entry dedicated loader
Author: login: fi3ework
Created: 2025-04-02T13:28:13Z | Merged: 2025-04-03T09:01:22Z

## Summary

Remove query entry, it's hack and may raise other unexpected issues. Supersede it with an entry dedicated loader, which will only executed for entry module.

## Related Links

<!--- Provide links of related issues or pages -->

## Checklist

<!--- Check and mark with an "x" -->

- [x] Tests updated (or not required).
- [ ] Documentation updated (or not required).



Diff:
diff --git a/packages/core/src/config.ts b/packages/core/src/config.ts
index 59600e8ca..aa6f89d9c 100644
--- a/packages/core/src/config.ts
+++ b/packages/core/src/config.ts
@@ -19,7 +19,6 @@ import {
   DEFAULT_CONFIG_NAME,
   DTS_EXTENSIONS_PATTERN,
   JS_EXTENSIONS_PATTERN,
-  RSLIB_ENTRY_QUERY,
   SWC_HELPERS,
 } from './constant';
 import {
@@ -940,9 +939,6 @@ const traverseEntryQuery = (
   return newEntry;
 };
 
-export const appendEntryQuery = (entries: RsbuildConfigEntry): RsbuildEntry =>
-  traverseEntryQuery(entries, (item) => `${item}?${RSLIB_ENTRY_QUERY}`);
-
 export const resolveEntryPath = (
   entries: RsbuildConfigEntry,
   root: string,
@@ -1020,7 +1016,7 @@ const composeEntryConfig = async (
     return {
       entryConfig: {
         source: {
-          entry: appendEntryQuery(resolveEntryPath(entries, root)),
+          entry: resolveEntryPath(entries, root),
         },
       },
       outBase: null,
@@ -1126,7 +1122,7 @@ const composeEntryConfig = async (
       rspack: {
         entry: async () => {
           const { resolvedEntries } = await scanGlobEntries(false);
-          return appendEntryQuery(resolvedEntries);
+          return resolvedEntries;
         },
       },
     },
diff --git a/packages/core/src/constant.ts b/packages/core/src/constant.ts
index 188f01a7d..2528c4ff0 100644
--- a/packages/core/src/constant.ts
+++ b/packages/core/src/constant.ts
@@ -10,7 +10,6 @@ export const DEFAULT_CONFIG_EXTENSIONS = [
 ] as const;
 
 export const SWC_HELPERS = '@swc/helpers';
-export const RSLIB_ENTRY_QUERY = '__rslib_entry__';
 export const SHEBANG_PREFIX = '#!';
 export const SHEBANG_REGEX: RegExp = /#!.*[\s\n\r]*$/;
 export const REACT_DIRECTIVE_REGEX: RegExp =
diff --git a/packages/core/src/plugins/EntryChunkPlugin.ts b/packages/core/src/plugins/EntryChunkPlugin.ts
index 7888d21c1..517274d9c 100644
--- a/packages/core/src/plugins/EntryChunkPlugin.ts
+++ b/packages/core/src/plugins/EntryChunkPlugin.ts
@@ -205,7 +205,9 @@ const entryModuleLoaderRsbuildPlugin = (): RsbuildPlugin => ({
   setup(api) {
     api.modifyBundlerChain((config, { CHAIN_ID }) => {
       config.module
-        .rule(CHAIN_ID.RULE.JS)
+        .rule(`Rslib:${CHAIN_ID.RULE.JS}-entry-loader`)
+        .test(config.module.rule(CHAIN_ID.RULE.JS).get('test'))
+        .issuer(/^$/)
         .use(LOADER_NAME)
         .loader(require.resolve('./entryModuleLoader.js'));
     });
diff --git a/packages/core/src/plugins/entryModuleLoader.ts b/packages/core/src/plugins/entryModuleLoader.ts
index b9199d579..bd62642a9 100644
--- a/packages/core/src/plugins/entryModuleLoader.ts
+++ b/packages/core/src/plugins/entryModuleLoader.ts
@@ -1,9 +1,5 @@
 import type { Rspack } from '@rsbuild/core';
-import {
-  REACT_DIRECTIVE_REGEX,
-  RSLIB_ENTRY_QUERY,
-  SHEBANG_REGEX,
-} from '../constant';
+import { REACT_DIRECTIVE_REGEX, SHEBANG_REGEX } from '../constant';
 
 function splitFromFirstLine(text: string): [string, string] {
   const match = text.match(/(\r\n|\n)/);
@@ -17,17 +13,15 @@ function splitFromFirstLine(text: string): [string, string] {
 const loader: Rspack.LoaderDefinition = function loader(source) {
   let result = source;
 
-  if (this.resourceQuery === `?${RSLIB_ENTRY_QUERY}`) {
-    const [firstLine1, rest] = splitFromFirstLine(result);
+  const [firstLine1, rest] = splitFromFirstLine(result);
 
-    if (SHEBANG_REGEX.test(firstLine1)) {
-      result = rest;
-    }
+  if (SHEBANG_REGEX.test(firstLine1)) {
+    result = rest;
+  }
 
-    const [firstLine2, rest2] = splitFromFirstLine(result);
-    if (REACT_DIRECTIVE_REGEX.test(firstLine2)) {
-      result = rest2;
-    }
+  const [firstLine2, rest2] = splitFromFirstLine(result);
+  if (REACT_DIRECTIVE_REGEX.test(firstLine2)) {
+    result = rest2;
   }
 
   return result;
diff --git a/packages/core/tests/entry.test.ts b/packages/core/tests/entry.test.ts
deleted file mode 100644
index c8914c485..000000000
--- a/packages/core/tests/entry.test.ts
+++ /dev/null
@@ -1,110 +0,0 @@
-import { describe, expect, test } from 'vitest';
-import { appendEntryQuery } from '../src/config';
-
-describe('appendEntryQuery', () => {
-  test('string', () => {
-    expect(
-      appendEntryQuery({
-        index: 'src/index.js',
-        foo: 'src/foo.js',
-      }),
-    ).toMatchInlineSnapshot(`
-      {
-        "foo": "src/foo.js?__rslib_entry__",
-        "index": "src/index.js?__rslib_entry__",
-      }
-    `);
-  });
-
-  test('string[]', () => {
-    expect(
-      appendEntryQuery({
-        index: ['src/index.ts', 'src/extra.ts'],
-        foo: ['src/foo.js'],
-      }),
-    ).toMatchInlineSnapshot(`
-      {
-        "foo": [
-          "src/foo.js?__rslib_entry__",
-        ],
-        "index": [
-          "src/index.ts?__rslib_entry__",
-          "src/extra.ts?__rslib_entry__",
-        ],
-      }
-    `);
-  });
-
-  test('Rspack.EntryDescription', () => {
-    expect(
-      appendEntryQuery({
-        index: {
-          import: ['src/index.ts', 'src/extra.ts'],
-          layer: 'l1',
-        },
-        foo: {
-          import: ['src/foo.js'],
-          dependOn: ['src/dep.js'],
-        },
-      }),
-    ).toMatchInlineSnapshot(`
-      {
-        "foo": {
-          "dependOn": [
-            "src/dep.js",
-          ],
-          "import": [
-            "src/foo.js?__rslib_entry__",
-          ],
-        },
-        "index": {
-          "import": [
-            "src/index.ts?__rslib_entry__",
-            "src/extra.ts?__rslib_entry__",
-          ],
-          "layer": "l1",
-        },
-      }
-    `);
-  });
-
-  test('combined', () => {
-    expect(
-      appendEntryQuery({
-        index: {
-          import: ['src/index.ts', 'src/extra.ts'],
-          layer: 'l1',
-        },
-        foo: {
-          import: ['src/foo.js'],
-          dependOn: ['src/dep.js'],
-        },
-        bar: 'src/bar.ts',
-        baz: ['src/baz.ts', 'src/bar.ts'],
-      }),
-    ).toMatchInlineSnapshot(`
-      {
-        "bar": "src/bar.ts?__rslib_entry__",
-        "baz": [
-          "src/baz.ts?__rslib_entry__",
-          "src/bar.ts?__rslib_entry__",
-        ],
-        "foo": {
-          "dependOn": [
-            "src/dep.js",
-          ],
-          "import": [
-            "src/foo.js?__rslib_entry__",
-          ],
-        },
-        "index": {
-          "import": [
-            "src/index.ts?__rslib_entry__",
-            "src/extra.ts?__rslib_entry__",
-          ],
-          "layer": "l1",
-        },
-      }
-    `);
-  });
-});
diff --git a/packages/plugin-dts/src/dts.ts b/packages/plugin-dts/src/dts.ts
index 5d9a0398f..41818d836 100644
--- a/packages/plugin-dts/src/dts.ts
+++ b/packages/plugin-dts/src/dts.ts
@@ -191,13 +191,10 @@ export async function generateDts(data: DtsGenOptions): Promise<void> {
           declarationDir!,
           relativePath,
           basename(entrySourcePath),
-        )
-          // Remove query in file path, such as RSLIB_ENTRY_QUERY.
-          .replace(/\?.*$/, '')
-          .replace(
-            /\.(js|mjs|jsx|ts|mts|tsx|cjs|cts|cjsx|ctsx|mjsx|mtsx)$/,
-            '.d.ts',
-          );
+        ).replace(
+          /\.(js|mjs|jsx|ts|mts|tsx|cjs|cts|cjsx|ctsx|mjsx|mtsx)$/,
+          '.d.ts',
+        );
         return { name: entryName, path: newPath };
       })
       .filter(Boolean) as Required<DtsEntry>[];
diff --git a/tests/integration/asset/__snapshots__/index.test.ts.snap b/tests/integration/asset/__snapshots__/index.test.ts.snap
index 7a2ba1181..18d0ca814 100644
--- a/tests/integration/asset/__snapshots__/index.test.ts.snap
+++ b/tests/integration/asset/__snapshots__/index.test.ts.snap
@@ -7,8 +7,8 @@ console.log(draft_namespaceObject);
 `;
 
 exports[`use asset/source 2`] = `
-"const draft_rslib_entry_namespaceObject = "this is a txt file\\nthis is a txt file\\n";
-export { draft_rslib_entry_namespaceObject as default };
+"const draft_namespaceObject = "this is a txt file\\nthis is a txt file\\n";
+export { draft_namespaceObject as default };
 "
 `;
 
@@ -19,8 +19,8 @@ console.log(draft_namespaceObject);
 `;
 
 exports[`use source.assetInclude 2`] = `
-"import draft_rslib_entry_namespaceObject from "../static/assets/draft.txt";
-export { draft_rslib_entry_namespaceObject as default };
+"import draft_namespaceObject from "../static/assets/draft.txt";
+export { draft_namespaceObject as default };
 "
 `;
 
@@ -49,8 +49,8 @@ const SvgLogo = (props)=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_r
             ]
         })
     });
-const logo_rslib_entry_ = __rslib_svgr_url__0__;
-export { SvgLogo as ReactComponent, logo_rslib_entry_ as default };
+const logo = __rslib_svgr_url__0__;
+export { SvgLogo as ReactComponent, logo as default };
 "
 `;
 
@@ -81,7 +81,7 @@ var __webpack_require__ = {};
 var __webpack_exports__ = {};
 __webpack_require__.r(__webpack_exports__);
 __webpack_require__.d(__webpack_exports__, {
-    default: ()=>logo_rslib_entry_,
+    default: ()=>logo,
     ReactComponent: ()=>SvgLogo
 });
 const jsx_runtime_namespaceObject = require("react/jsx-runtime");
@@ -107,7 +107,7 @@ const SvgLogo = (props)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("svg
             ]
         })
     });
-const logo_rslib_entry_ = require("../static/svg/logo.svg");
+const logo = require("../static/svg/logo.svg");
 exports.ReactComponent = __webpack_exports__.ReactComponent;
 exports["default"] = __webpack_exports__["default"];
 for(var __webpack_i__ in __webpack_exports__)if (-1 === [
@@ -144,8 +144,8 @@ const SvgLogo = (props)=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_r
             ]
         })
     });
-const logo_rslib_entry_ = SvgLogo;
-export { logo_rslib_entry_ as default };
+const logo = SvgLogo;
+export { logo as default };
 "
 `;
 
@@ -176,7 +176,7 @@ var __webpack_require__ = {};
 var __webpack_exports__ = {};
 __webpack_require__.r(__webpack_exports__);
 __webpack_require__.d(__webpack_exports__, {
-    default: ()=>logo_rslib_entry_
+    default: ()=>logo
 });
 const jsx_runtime_namespaceObject = require("react/jsx-runtime");
 require("react");
@@ -201,7 +201,7 @@ const SvgLogo = (props)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("svg
             ]
         })
     });
-const logo_rslib_entry_ = SvgLogo;
+const logo = SvgLogo;
 exports["default"] = __webpack_exports__["default"];
 for(var __webpack_i__ in __webpack_exports__)if (-1 === [
     "default"
@@ -213,15 +213,15 @@ Object.defineProperty(exports, '__esModule', {
 `;
 
 exports[`use svgr > should only contain url default export 1`] = `
-"import logo2_rslib_entry_namespaceObject from "../static/svg/logo2.svg";
-export { logo2_rslib_entry_namespaceObject as default };
+"import logo2_namespaceObject from "../static/svg/logo2.svg";
+export { logo2_namespaceObject as default };
 "
 `;
 
 exports[`use svgr > should only contain url default export 2`] = `
 ""use strict";
 var __webpack_modules__ = {
-    "./src/assets/logo2.svg?__rslib_entry__": function(module) {
+    "./src/assets/logo2.svg": function(module) {
         module.exports = require("../static/svg/logo2.svg");
     }
 };
@@ -235,7 +235,7 @@ function __webpack_require__(moduleId) {
     __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
     return module.exports;
 }
-var __webpack_exports__ = __webpack_require__("./src/assets/logo2.svg?__rslib_entry__");
+var __webpack_exports__ = __webpack_require__("./src/assets/logo2.svg");
 exports["default"] = __webpack_exports__["default"];
 for(var __webpack_i__ in __webpack_exports__)if (-1 === [
     "default"
diff --git a/tests/integration/asset/index.test.ts b/tests/integration/asset/index.test.ts
index f2569dbad..f41449caf 100644
--- a/tests/integration/asset/index.test.ts
+++ b/tests/integration/asset/index.test.ts
@@ -36,13 +36,13 @@ test('set the size threshold to inline static assets', async () => {
   const { content: logoJs2 } = queryContent(contents.esm2!, /assets\/logo\.js/);
   expect(indexJs2).toMatchInlineSnapshot(`
     "import * as __WEBPACK_EXTERNAL_MODULE__assets_logo_js_450929b7__ from "./assets/logo.js";
-    const src_rslib_entry_ = __WEBPACK_EXTERNAL_MODULE__assets_logo_js_450929b7__["default"];
-    export { src_rslib_entry_ as default };
+    const src = __WEBPACK_EXTERNAL_MODULE__assets_logo_js_450929b7__["default"];
+    export { src as default };
     "
   `);
   expect(logoJs2).toMatchInlineSnapshot(`
-    "import logo_rslib_entry_namespaceObject from "../static/svg/logo.svg";
-    export { logo_rslib_entry_namespaceObject as default };
+    "import logo_namespaceObject from "../static/svg/logo.svg";
+    export { logo_namespaceObject as default };
     "
   `);
   // cjs
@@ -57,7 +57,7 @@ test('set the size threshold to inline static assets', async () => {
   expect(logoCjs2).toMatchInlineSnapshot(`
     ""use strict";
     var __webpack_modules__ = {
-        "./src/assets/logo.svg?__rslib_entry__": function(module) {
+        "./src/assets/logo.svg": function(module) {
             module.exports = require("../static/svg/logo.svg");
         }
     };
@@ -71,7 +71,7 @@ test('set the size threshold to inline static assets', async () => {
         __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
         return module.exports;
     }
-    var __webpack_exports__ = __webpack_require__("./src/assets/logo.svg?__rslib_entry__");
+    var __webpack_exports__ = __webpack_require__("./src/assets/logo.svg");
     exports["default"] = __webpack_exports__["default"];
     for(var __webpack_i__ in __webpack_exports__)if (-1 === [
         "default"
@@ -105,8 +105,8 @@ test('set the assets filename with hash', async () => {
     /assets\/image\.js/,
   );
   expect(imageJs1).toMatchInlineSnapshot(`
-    "import image_rslib_entry_namespaceObject from "../static/image/image.c74653c1.png";
-    export { image_rslib_entry_namespaceObject as default };
+    "import image_namespaceObject from "../static/image/image.c74653c1.png";
+    export { image_namespaceObject as default };
     "
   `);
   // cjs
@@ -117,7 +117,7 @@ test('set the assets filename with hash', async () => {
   expect(imageCjs1).toMatchInlineSnapshot(`
     ""use strict";
     var __webpack_modules__ = {
-        "./src/assets/image.png?__rslib_entry__": function(module) {
+        "./src/assets/image.png": function(module) {
             module.exports = require("../static/image/image.c74653c1.png");
         }
     };
@@ -131,7 +131,7 @@ test('set the assets filename with hash', async () => {
         __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
         return module.exports;
     }
-    var __webpack_exports__ = __webpack_require__("./src/assets/image.png?__rslib_entry__");
+    var __webpack_exports__ = __webpack_require__("./src/assets/image.png");
     exports["default"] = __webpack_exports__["default"];
     for(var __webpack_i__ in __webpack_exports__)if (-1 === [
         "default"
@@ -165,8 +165,8 @@ test('set the assets output path', async () => {
     /assets\/image\.js/,
   );
   expect(imageJs1).toMatchInlineSnapshot(`
-    "import image_rslib_entry_namespaceObject from "../assets/bundleless/image.png";
-    export { image_rslib_entry_namespaceObject as default };
+    "import image_namespaceObject from "../assets/bundleless/image.png";
+    export { image_namespaceObject as default };
     "
   `);
   // cjs
@@ -177,7 +177,7 @@ test('set the assets output path', async () => {
   expect(imageCjs1).toMatchInlineSnapshot(`
     ""use strict";
     var __webpack_modules__ = {
-        "./src/assets/image.png?__rslib_entry__": function(module) {
+        "./src/assets/image.png": function(module) {
             module.exports = require("../assets/bundleless/image.png");
         }
     };
@@ -191,7 +191,7 @@ test('set the assets output path', async () => {
         __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
         return module.exports;
     }
-    var __webpack_exports__ = __webpack_require__("./src/assets/image.png?__rslib_entry__");
+    var __webpack_exports__ = __webpack_require__("./src/assets/image.png");
     exports["default"] = __webpack_exports__["default"];
     for(var __webpack_i__ in __webpack_exports__)if (-1 === [
         "default"
@@ -258,8 +258,8 @@ test('set the assets public path', async () => {
     (()=>{
         __webpack_require__.p = "/public/path/";
     })();
-    const image_rslib_entry_namespaceObject = __webpack_require__.p + "static/image/image.png";
-    export { image_rslib_entry_namespaceObject as default };
+    const image_namespaceObject = __webpack_require__.p + "static/image/image.png";
+    export { image_namespaceObject as default };
     "
   `);
 });
diff --git a/tests/integration/bundle-false/__snapshots__/index.test.ts.snap b/tests/integration/bundle-false/__snapshots__/index.test.ts.snap
index c260bfdf3..a1b4399e0 100644
--- a/tests/integration/bundle-false/__snapshots__/index.test.ts.snap
+++ b/tests/integration/bundle-false/__snapshots__/index.test.ts.snap
@@ -25,8 +25,8 @@ const SvgLogo = (props)=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_r
             ]
         })
     });
-const logo_rslib_entry_ = __rslib_svgr_url__0__;
-export { SvgLogo as ReactComponent, logo_rslib_entry_ as default };
+const logo = __rslib_svgr_url__0__;
+export { SvgLogo as ReactComponent, logo as default };
 "
 `;
 
@@ -57,7 +57,7 @@ var __webpack_require__ = {};
 var __webpack_exports__ = {};
 __webpack_require__.r(__webpack_exports__);
 __webpack_require__.d(__webpack_exports__, {
-    default: ()=>logo_rslib_entry_,
+    default: ()=>logo,
     ReactComponent: ()=>SvgLogo
 });
 const jsx_runtime_namespaceObject = require("react/jsx-runtime");
@@ -83,7 +83,7 @@ const SvgLogo = (props)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("svg
             ]
         })
     });
-const logo_rslib_entry_ = require("../static/svg/logo.svg");
+const logo = require("../static/svg/logo.svg");
 exports.ReactComponent = __webpack_exports__.ReactComponent;
 exports["default"] = __webpack_exports__["default"];
 for(var __webpack_i__ in __webpack_exports__)if (-1 === [
diff --git a/tests/integration/bundle-false/index.test.ts b/tests/integration/bundle-false/index.test.ts
index 2b37a2020..56b86d56d 100644
--- a/tests/integration/bundle-false/index.test.ts
+++ b/tests/integration/bundle-false/index.test.ts
@@ -118,8 +118,8 @@ test('monorepo', async () => {
     }).content,
   ).toMatchInlineSnapshot(`
     "import * as __WEBPACK_EXTERNAL_MODULE_bundle_false_monorepo_importee_test_35ca595f__ from "bundle-false-monorepo-importee-test";
-    const src_rslib_entry_ = __WEBPACK_EXTERNAL_MODULE_bundle_false_monorepo_importee_test_35ca595f__["default"];
-    export { src_rslib_entry_ as default };
+    const src = __WEBPACK_EXTERNAL_MODULE_bundle_false_monorepo_importee_test_35ca595f__["default"];
+    export { src as default };
     "
   `);
 });
@@ -190,19 +190,19 @@ test('asset in bundleless', async () => {
   const { contents } = await buildAndGetResults({ fixturePath });
 
   expect(Object.values(contents.esm)[0]).toMatchInlineSnapshot(`
-    "import image_rslib_entry_namespaceObject from "../static/image/image.png";
-    export { image_rslib_entry_namespaceObject as default };
+    "import image_namespaceObject from "../static/image/image.png";
+    export { image_namespaceObject as default };
     "
   `);
   expect(Object.values(contents.esm)[1]).toMatchInlineSnapshot(`
-    "import logo_rslib_entry_namespaceObject from "../static/svg/logo.svg";
-    export { logo_rslib_entry_namespaceObject as default };
+    "import logo_namespaceObject from "../static/svg/logo.svg";
+    export { logo_namespaceObject as default };
     "
   `);
   expect(Object.values(contents.cjs)[0]).toMatchInlineSnapshot(`
     ""use strict";
     var __webpack_modules__ = {
-        "./src/assets/image.png?__rslib_entry__": function(module) {
+        "./src/assets/image.png": function(module) {
             module.exports = require("../static/image/image.png");
         }
     };
@@ -216,7 +216,7 @@ test('asset in bundleless', async () => {
         __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
         return module.exports;
     }
-    var __webpack_exports__ = __webpack_require__("./src/assets/image.png?__rslib_entry__");
+    var __webpack_exports__ = __webpack_require__("./src/assets/image.png");
     exports["default"] = __webpack_exports__["default"];
     for(var __webpack_i__ in __webpack_exports__)if (-1 === [
         "default"
@@ -229,7 +229,7 @@ test('asset in bundleless', async () => {
   expect(Object.values(contents.cjs)[1]).toMatchInlineSnapshot(`
     ""use strict";
     var __webpack_modules__ = {
-        "./src/assets/logo.svg?__rslib_entry__": function(module) {
+        "./src/assets/logo.svg": function(module) {
             module.exports = require("../static/svg/logo.svg");
         }
     };
@@ -243,7 +243,7 @@ test('asset in bundleless', async () => {
         __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
         return module.exports;
     }
-    var __webpack_exports__ = __webpack_require__("./src/assets/logo.svg?__rslib_entry__");
+    var __webpack_exports__ = __webpack_require__("./src/assets/logo.svg");
     exports["default"] = __webpack_exports__["default"];
     for(var __webpack_i__ in __webpack_exports__)if (-1 === [
         "default"
diff --git a/tests/integration/decorators/__snapshots__/index.test.ts.snap b/tests/integration/decorators/__snapshots__/index.test.ts.snap
index 435caedcb..65c1afdba 100644
--- a/tests/integration/decorators/__snapshots__/index.test.ts.snap
+++ b/tests/integration/decorators/__snapshots__/index.test.ts.snap
@@ -296,13 +296,13 @@ function _apply_decs_2203_r(targetClass, memberDecs, classDecs, parentClass) {
     return (_apply_decs_2203_r = applyDecs2203RFactory())(targetClass, memberDecs, classDecs, parentClass);
 }
 var _dec, _initClass;
-function src_rslib_entry_enhancer(name) {
+function src_enhancer(name) {
     return function(target) {
         target.prototype.name = name;
     };
 }
 let _Person;
-_dec = src_rslib_entry_enhancer('rslib');
+_dec = src_enhancer('rslib');
 class Person {
     static{
         ({ c: [_Person, _initClass] } = _apply_decs_2203_r(this, [], [
@@ -331,7 +331,7 @@ exports[`decorators with experimentalDecorators in tsconfig 1`] = `
 function _ts_metadata(k, v) {
     if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
 }
-function src_rslib_entry_enhancer(name) {
+function src_enhancer(name) {
     return function(target) {
         target.prototype.name = name;
     };
@@ -342,7 +342,7 @@ class Person {
     }
 }
 Person = _ts_decorate([
-    src_rslib_entry_enhancer('rslib'),
+    src_enhancer('rslib'),
     _ts_metadata("design:type", Function),
     _ts_metadata("design:paramtypes", [])
 ], Person);
@@ -646,13 +646,13 @@ function _apply_decs_2203_r(targetClass, memberDecs, classDecs, parentClass) {
     return (_apply_decs_2203_r = applyDecs2203RFactory())(targetClass, memberDecs, classDecs, parentClass);
 }
 var _dec, _initClass;
-function src_rslib_entry_enhancer(name) {
+function src_enhancer(name) {
     return function(target) {
         target.prototype.name = name;
     };
 }
 let _Person;
-_dec = src_rslib_entry_enhancer('rslib');
+_dec = src_enhancer('rslib');
 class Person {
     static{
         ({ c: [_Person, _initClass] } = _apply_decs_2203_r(this, [], [
diff --git a/tests/integration/directive/index.test.ts b/tests/integration/directive/index.test.ts
index 66bdb1818..5273589c3 100644
--- a/tests/integration/directive/index.test.ts
+++ b/tests/integration/directive/index.test.ts
@@ -4,7 +4,9 @@ import { join } from 'node:path';
 import { buildAndGetResults, queryContent } from 'test-helper';
 import { describe, expect, test } from 'vitest';
 
-// The test for `import.meta.url` shim is in tests/integration/shims/index.test.ts
+const onlyStartsWith = (str: string, target: string) => {
+  return str.split(target).length === 2 && str.startsWith(target);
+};
 
 describe('shebang', async () => {
   const fixturePath = join(__dirname, 'shebang');
@@ -14,11 +16,11 @@ describe('shebang', async () => {
 
   describe('bundle', async () => {
     test('shebang at the beginning', async () => {
-      expect(entries.esm0!.startsWith('#!/usr/bin/env node')).toBe(true);
+      expect(onlyStartsWith(entries.esm0!, '#!/usr/bin/env node')).toBe(true);
     });
 
     test('shebang at the beginning even if minified', async () => {
-      expect(entries.esm1!.startsWith('#!/usr/bin/env node')).toBe(true);
+      expect(onlyStartsWith(entries.esm1!, '#!/usr/bin/env node')).toBe(true);
     });
   });
 
@@ -27,12 +29,12 @@ describe('shebang', async () => {
       const { content: index } = queryContent(contents.esm2!, 'index.js', {
         basename: true,
       });
-      expect(index!.startsWith('#!/usr/bin/env node')).toBe(true);
+      expect(onlyStartsWith(index!, '#!/usr/bin/env node')).toBe(true);
 
       const { content: bar } = queryContent(contents.esm2!, 'bar.js', {
         basename: true,
       });
-      expect(bar!.startsWith('#!/usr/bin/env node')).toBe(true);
+      expect(onlyStartsWith(bar!, '#!/usr/bin/env node')).toBe(true);
 
       const { content: foo } = queryContent(contents.esm2!, 'foo.js', {
         basename: true,
@@ -44,12 +46,12 @@ describe('shebang', async () => {
       const { content: index } = queryContent(contents.esm3!, 'index.js', {
         basename: true,
       });
-      expect(index!.startsWith('#!/usr/bin/env node')).toBe(true);
+      expect(onlyStartsWith(index!, '#!/usr/bin/env node')).toBe(true);
 
       const { content: bar } = queryContent(contents.esm3!, 'bar.js', {
         basename: true,
       });
-      expect(bar!.startsWith('#!/usr/bin/env node')).toBe(true);
+      expect(onlyStartsWith(bar!, '#!/usr/bin/env node')).toBe(true);
 
       const { content: foo } = queryContent(contents.esm2!, 'foo.js', {
         basename: true,
@@ -96,24 +98,24 @@ describe('react', async () => {
       const { content: foo } = queryContent(contents.esm!, 'foo.js', {
         basename: true,
       });
-      expect(foo!.startsWith(`'use client';`)).toBe(true);
+      expect(onlyStartsWith(foo!, `'use client';`)).toBe(true);
 
       const { content: bar } = queryContent(contents.esm!, 'bar.js', {
         basename: true,
       });
-      expect(bar!.startsWith(`'use server';`)).toBe(true);
+      expect(onlyStartsWith(bar!, `'use server';`)).toBe(true);
     });
 
     test('React directive at the beginning even if minified', async () => {
       const { content: foo } = queryContent(contents.cjs!, 'foo.cjs', {
         basename: true,
       });
-      expect(foo!.startsWith(`'use client';`)).toBe(true);
+      expect(onlyStartsWith(foo!, `'use client';`)).toBe(true);
 
       const { content: bar } = queryContent(contents.cjs!, 'bar.cjs', {
         basename: true,
       });
-      expect(bar!.startsWith(`'use server';`)).toBe(true);
+      expect(onlyStartsWith(bar!, `'use server';`)).toBe(true);
     });
   });
 });
diff --git a/tests/integration/entry/index.test.ts b/tests/integration/entry/index.test.ts
index 2ee1bdf64..12b61dc19 100644
--- a/tests/integration/entry/index.test.ts
+++ b/tests/integration/entry/index.test.ts
@@ -50,13 +50,11 @@ test('multiple entry bundle', async () => {
   expect(files).toMatchInlineSnapshot(`
     {
       "cjs": [
-        "<ROOT>/tests/integration/entry/multiple/dist/cjs/bar.cjs",
         "<ROOT>/tests/integration/entry/multiple/dist/cjs/foo.cjs",
         "<ROOT>/tests/integration/entry/multiple/dist/cjs/index.cjs",
         "<ROOT>/tests/integration/entry/multiple/dist/cjs/shared.cjs",
       ],
       "esm": [
-        "<ROOT>/tests/integration/entry/multiple/dist/esm/bar.js",
         "<ROOT>/tests/integration/entry/multiple/dist/esm/foo.js",
         "<ROOT>/tests/integration/entry/multiple/dist/esm/index.js",
         "<ROOT>/tests/integration/entry/multiple/dist/esm/shared.js",
@@ -70,8 +68,8 @@ test('multiple entry bundle', async () => {
   expect(index).toMatchInlineSnapshot(`
     "const shared = 'shared';
     const foo = 'foo' + shared;
-    const src_rslib_entry_text = ()=>\`hello \${foo} \${shared}\`;
-    export { src_rslib_entry_text as text };
+    const src_text = ()=>\`hello \${foo} \${shared}\`;
+    export { src_text as text };
     "
   `);
 
@@ -85,15 +83,6 @@ test('multiple entry bundle', async () => {
     "
   `);
 
-  const { content: bar } = queryContent(contents.esm, 'bar.js', {
-    basename: true,
-  });
-  expect(bar).toMatchInlineSnapshot(`
-    "const bar = 'bar';
-    export { bar };
-    "
-  `);
-
   const { content: shared } = queryContent(contents.esm, 'shared.js', {
     basename: true,
   });
diff --git a/tests/integration/entry/multiple/rslib.config.ts b/tests/integration/entry/multiple/rslib.config.ts
index db7608bd2..6868d43c0 100644
--- a/tests/integration/entry/multiple/rslib.config.ts
+++ b/tests/integration/entry/multiple/rslib.config.ts
@@ -7,7 +7,6 @@ export default defineConfig({
     entry: {
       index: './src/index.ts',
       foo: './src/foo.ts',
-      bar: './src/bar.ts',
       shared: './src/shared.ts',
     },
   },
diff --git a/tests/integration/entry/multiple/src/bar.ts b/tests/integration/entry/multiple/src/bar.ts
deleted file mode 100644
index 9f1738685..000000000
--- a/tests/integration/entry/multiple/src/bar.ts
+++ /dev/null
@@ -1 +0,0 @@
-export const bar = 'bar';
diff --git a/tests/integration/external-helpers/__snapshots__/index.test.ts.snap b/tests/integration/external-helpers/__snapshots__/index.test.ts.snap
index 0ddb86c55..5dbf3b07d 100644
--- a/tests/integration/external-helpers/__snapshots__/index.test.ts.snap
+++ b/tests/integration/external-helpers/__snapshots__/index.test.ts.snap
@@ -3,7 +3,7 @@
 exports[`should external @swc/helpers when externalHelpers is true 1`] = `
 "import * as __WEBPACK_EXTERNAL_MODULE__swc_helpers_class_call_check_f500f6c3__ from "@swc/helpers/_/_class_call_check";
 import * as __WEBPACK_EXTERNAL_MODULE__swc_helpers_create_class_63e94838__ from "@swc/helpers/_/_create_class";
-var src_rslib_entry_FOO = /*#__PURE__*/ function() {
+var src_FOO = /*#__PURE__*/ function() {
     "use strict";
     function FOO() {
         (0, __WEBPACK_EXTERNAL_MODULE__swc_helpers_class_call_check_f500f6c3__._)(this, FOO);
@@ -16,14 +16,14 @@ var src_rslib_entry_FOO = /*#__PURE__*/ function() {
     ]);
     return FOO;
 }();
-export { src_rslib_entry_FOO as default };
+export { src_FOO as default };
 "
 `;
 
 exports[`should external @swc/helpers when externalHelpers is true 2`] = `
 "import * as __WEBPACK_EXTERNAL_MODULE__swc_helpers_class_call_check_f500f6c3__ from "@swc/helpers/_/_class_call_check";
 import * as __WEBPACK_EXTERNAL_MODULE__swc_helpers_create_class_63e94838__ from "@swc/helpers/_/_create_class";
-var src_rslib_entry_FOO = /*#__PURE__*/ function() {
+var src_FOO = /*#__PURE__*/ function() {
     "use strict";
     function FOO() {
         (0, __WEBPACK_EXTERNAL_MODULE__swc_helpers_class_call_check_f500f6c3__._)(this, FOO);
@@ -36,7 +36,7 @@ var src_rslib_entry_FOO = /*#__PURE__*/ function() {
     ]);
     return FOO;
 }();
-export { src_rslib_entry_FOO as default };
+export { src_FOO as default };
 "
 `;
 
@@ -58,7 +58,7 @@ function _create_class(Constructor, protoProps, staticProps) {
     if (staticProps) _defineProperties(Constructor, staticProps);
     return Constructor;
 }
-var src_rslib_entry_FOO = /*#__PURE__*/ function() {
+var src_FOO = /*#__PURE__*/ function() {
     "use strict";
     function FOO() {
         _class_call_check(this, FOO);
@@ -71,7 +71,7 @@ var src_rslib_entry_FOO = /*#__PURE__*/ function() {
     ]);
     return FOO;
 }();
-export { src_rslib_entry_FOO as default };
+export { src_FOO as default };
 "
 `;
 
@@ -93,7 +93,7 @@ function _create_class(Constructor, protoProps, staticProps) {
     if (staticProps) _defineProperties(Constructor, staticProps);
     return Constructor;
 }
-var src_rslib_entry_FOO = /*#__PURE__*/ function() {
+var src_FOO = /*#__PURE__*/ function() {
     "use strict";
     function FOO() {
         _class_call_check(this, FOO);
@@ -106,14 +106,14 @@ var src_rslib_entry_FOO = /*#__PURE__*/ function() {
     ]);
     return FOO;
 }();
-export { src_rslib_entry_FOO as default };
+export { src_FOO as default };
 "
 `;
 
 exports[`should respect user override externalHelpers config 2`] = `
 "import * as __WEBPACK_EXTERNAL_MODULE__swc_helpers_class_call_check_f500f6c3__ from "@swc/helpers/_/_class_call_check";
 import * as __WEBPACK_EXTERNAL_MODULE__swc_helpers_create_class_63e94838__ from "@swc/helpers/_/_create_class";
-var src_rslib_entry_FOO = /*#__PURE__*/ function() {
+var src_FOO = /*#__PURE__*/ function() {
     "use strict";
     function FOO() {
         (0, __WEBPACK_EXTERNAL_MODULE__swc_helpers_class_call_check_f500f6c3__._)(this, FOO);
@@ -126,6 +126,6 @@ var src_rslib_entry_FOO = /*#__PURE__*/ function() {
     ]);
     return FOO;
 }();
-export { src_rslib_entry_FOO as default };
+export { src_FOO as default };
 "
 `;
diff --git a/tests/integration/minify/index.test.ts b/tests/integration/minify/index.test.ts
index 2f5dc64dd..6f7464dac 100644
--- a/tests/integration/minify/index.test.ts
+++ b/tests/integration/minify/index.test.ts
@@ -24,7 +24,7 @@ describe('minify config', () => {
 
       ;// CONCATENATED MODULE: external "react/jsx-runtime"
 
-      ;// CONCATENATED MODULE: ../../__fixtures__/src/index.ts?__rslib_entry__
+      ;// CONCATENATED MODULE: ../../__fixtures__/src/index.ts
       /*! Legal Comment */ 
       const foo = ()=>{};
       const bar = ()=>{};
diff --git a/tests/integration/redirect/js.test.ts b/tests/integration/redirect/js.test.ts
index 046872f10..05304c408 100644
--- a/tests/integration/redirect/js.test.ts
+++ b/tests/integration/redirect/js.test.ts
@@ -25,8 +25,8 @@ test('redirect.js default', async () => {
     import * as __WEBPACK_EXTERNAL_MODULE__bar_index_js_89500c0c__ from "./bar/index.js";
     import * as __WEBPACK_EXTERNAL_MODULE__foo_js_fdf5aa2d__ from "./foo.js";
     import * as __WEBPACK_EXTERNAL_MODULE__baz_js_a2c1c788__ from "./baz.js";
-    const src_rslib_entry_ = __WEBPACK_EXTERNAL_MODULE_lodash__["default"].toUpper(__WEBPACK_EXTERNAL_MODULE__foo_js_fdf5aa2d__.foo + __WEBPACK_EXTERNAL_MODULE__bar_index_js_89500c0c__.bar + __WEBPACK_EXTERNAL_MODULE__foo_js_fdf5aa2d__.foo + __WEBPACK_EXTERNAL_MODULE__bar_index_js_89500c0c__.bar + __WEBPACK_EXTERNAL_MODULE__baz_js_a2c1c788__.baz + typeof __WEBPACK_EXTERNAL_MODULE_prettier__["default"].version);
-    export { src_rslib_entry_ as default };
+    const src = __WEBPACK_EXTERNAL_MODULE_lodash__["default"].toUpper(__WEBPACK_EXTERNAL_MODULE__foo_js_fdf5aa2d__.foo + __WEBPACK_EXTERNAL_MODULE__bar_index_js_89500c0c__.bar + __WEBPACK_EXTERNAL_MODULE__foo_js_fdf5aa2d__.foo + __WEBPACK_EXTERNAL_MODULE__bar_index_js_89500c0c__.bar + __WEBPACK_EXTERNAL_MODULE__baz_js_a2c1c788__.baz + typeof __WEBPACK_EXTERNAL_MODULE_prettier__["default"].version);
+    export { src as default };
     "
   `);
 
@@ -51,8 +51,8 @@ test('redirect.js.path false', async () => {
     import * as __WEBPACK_EXTERNAL_MODULE__baz_3ce4598c__ from "~/baz";
     import * as __WEBPACK_EXTERNAL_MODULE__bar_js_69b41beb__ from "./bar.js";
     import * as __WEBPACK_EXTERNAL_MODULE__foo_js_fdf5aa2d__ from "./foo.js";
-    const src_rslib_entry_ = __WEBPACK_EXTERNAL_MODULE_lodash__["default"].toUpper(__WEBPACK_EXTERNAL_MODULE__foo_js_fdf5aa2d__.foo + __WEBPACK_EXTERNAL_MODULE__bar_js_69b41beb__.bar + __WEBPACK_EXTERNAL_MODULE__foo_a5f33889__.foo + __WEBPACK_EXTERNAL_MODULE__bar_943a8c75__.bar + __WEBPACK_EXTERNAL_MODULE__baz_3ce4598c__.baz + typeof __WEBPACK_EXTERNAL_MODULE_prettier__["default"].version);
-    export { src_rslib_entry_ as default };
+    const src = __WEBPACK_EXTERNAL_MODULE_lodash__["default"].toUpper(__WEBPACK_EXTERNAL_MODULE__foo_js_fdf5aa2d__.foo + __WEBPACK_EXTERNAL_MODULE__bar_js_69b41beb__.bar + __WEBPACK_EXTERNAL_MODULE__foo_a5f33889__.foo + __WEBPACK_EXTERNAL_MODULE__bar_943a8c75__.bar + __WEBPACK_EXTERNAL_MODULE__baz_3ce4598c__.baz + typeof __WEBPACK_EXTERNAL_MODULE_prettier__["default"].version);
+    export { src as default };
     "
   `);
 });
@@ -75,8 +75,8 @@ test('redirect.js.path with user override externals', async () => {
     import * as __WEBPACK_EXTERNAL_MODULE__baz_js_a2c1c788__ from "./baz.js";
     import * as __WEBPACK_EXTERNAL_MODULE__bar_index_js_89500c0c__ from "./bar/index.js";
     import * as __WEBPACK_EXTERNAL_MODULE__foo_js_fdf5aa2d__ from "./foo.js";
-    const src_rslib_entry_ = __WEBPACK_EXTERNAL_MODULE_lodash__["default"].toUpper(__WEBPACK_EXTERNAL_MODULE__foo_js_fdf5aa2d__.foo + __WEBPACK_EXTERNAL_MODULE__bar_index_js_89500c0c__.bar + __WEBPACK_EXTERNAL_MODULE__others_foo_js_920f94ba__.foo + __WEBPACK_EXTERNAL_MODULE__others_bar_index_js_6776b573__.bar + __WEBPACK_EXTERNAL_MODULE__baz_js_a2c1c788__.baz + typeof __WEBPACK_EXTERNAL_MODULE_prettier__["default"].version);
-    export { src_rslib_entry_ as default };
+    const src = __WEBPACK_EXTERNAL_MODULE_lodash__["default"].toUpper(__WEBPACK_EXTERNAL_MODULE__foo_js_fdf5aa2d__.foo + __WEBPACK_EXTERNAL_MODULE__bar_index_js_89500c0c__.bar + __WEBPACK_EXTERNAL_MODULE__others_foo_js_920f94ba__.foo + __WEBPACK_EXTERNAL_MODULE__others_bar_index_js_6776b573__.bar + __WEBPACK_EXTERNAL_MODULE__baz_js_a2c1c788__.baz + typeof __WEBPACK_EXTERNAL_MODULE_prettier__["default"].version);
+    export { src as default };
     "
   `);
 
@@ -107,8 +107,8 @@ test('redirect.js.path with user override alias', async () => {
     import * as __WEBPACK_EXTERNAL_MODULE__baz_js_a2c1c788__ from "./baz.js";
     import * as __WEBPACK_EXTERNAL_MODULE__bar_index_js_89500c0c__ from "./bar/index.js";
     import * as __WEBPACK_EXTERNAL_MODULE__foo_js_fdf5aa2d__ from "./foo.js";
-    const src_rslib_entry_ = __WEBPACK_EXTERNAL_MODULE_lodash__["default"].toUpper(__WEBPACK_EXTERNAL_MODULE__foo_js_fdf5aa2d__.foo + __WEBPACK_EXTERNAL_MODULE__bar_index_js_89500c0c__.bar + __WEBPACK_EXTERNAL_MODULE__others_foo_js_920f94ba__.foo + __WEBPACK_EXTERNAL_MODULE__others_bar_index_js_6776b573__.bar + __WEBPACK_EXTERNAL_MODULE__baz_js_a2c1c788__.baz + typeof __WEBPACK_EXTERNAL_MODULE_prettier__["default"].version);
-    export { src_rslib_entry_ as default };
+    const src = __WEBPACK_EXTERNAL_MODULE_lodash__["default"].toUpper(__WEBPACK_EXTERNAL_MODULE__foo_js_fdf5aa2d__.foo + __WEBPACK_EXTERNAL_MODULE__bar_index_js_89500c0c__.bar + __WEBPACK_EXTERNAL_MODULE__others_foo_js_920f94ba__.foo + __WEBPACK_EXTERNAL_MODULE__others_bar_index_js_6776b573__.bar + __WEBPACK_EXTERNAL_MODULE__baz_js_a2c1c788__.baz + typeof __WEBPACK_EXTERNAL_MODULE_prettier__["default"].version);
+    export { src as default };
     "
   `);
 
@@ -132,8 +132,8 @@ test('redirect.js.extension: false', async () => {
     import * as __WEBPACK_EXTERNAL_MODULE__bar_index_ts_bd8d18e6__ from "./bar/index.ts";
     import * as __WEBPACK_EXTERNAL_MODULE__foo_ts_a526d0a1__ from "./foo.ts";
     import * as __WEBPACK_EXTERNAL_MODULE__baz_ts_10ee073f__ from "./baz.ts";
-    const src_rslib_entry_ = __WEBPACK_EXTERNAL_MODULE_lodash__["default"].toUpper(__WEBPACK_EXTERNAL_MODULE__foo_ts_a526d0a1__.foo + __WEBPACK_EXTERNAL_MODULE__bar_index_ts_bd8d18e6__.bar + __WEBPACK_EXTERNAL_MODULE__foo_ts_a526d0a1__.foo + __WEBPACK_EXTERNAL_MODULE__bar_index_ts_bd8d18e6__.bar + __WEBPACK_EXTERNAL_MODULE__baz_ts_10ee073f__.baz + typeof __WEBPACK_EXTERNAL_MODULE_prettier__["default"].version);
-    export { src_rslib_entry_ as default };
+    const src = __WEBPACK_EXTERNAL_MODULE_lodash__["default"].toUpper(__WEBPACK_EXTERNAL_MODULE__foo_ts_a526d0a1__.foo + __WEBPACK_EXTERNAL_MODULE__bar_index_ts_bd8d18e6__.bar + __WEBPACK_EXTERNAL_MODULE__foo_ts_a526d0a1__.foo + __WEBPACK_EXTERNAL_MODULE__bar_index_ts_bd8d18e6__.bar + __WEBPACK_EXTERNAL_MODULE__baz_ts_10ee073f__.baz + typeof __WEBPACK_EXTERNAL_MODULE_prettier__["default"].version);
+    export { src as default };
     "
   `);
 });
diff --git a/tests/integration/redirect/jsNotResolved.test.ts b/tests/integration/redirect/jsNotResolved.test.ts
index 960d7582c..88713a519 100644
--- a/tests/integration/redirect/jsNotResolved.test.ts
+++ b/tests/integration/redirect/jsNotResolved.test.ts
@@ -17,8 +17,8 @@ test('redirect.js default', async () => {
     import * as __WEBPACK_EXTERNAL_MODULE_prettier__ from "prettier";
     import * as __WEBPACK_EXTERNAL_MODULE__bar_js_69b41beb__ from "./bar.js";
     import * as __WEBPACK_EXTERNAL_MODULE__foo_js_fdf5aa2d__ from "./foo.js";
-    const src_rslib_entry_ = __WEBPACK_EXTERNAL_MODULE_lodash__["default"].toUpper(__WEBPACK_EXTERNAL_MODULE__foo_js_fdf5aa2d__["default"] + __WEBPACK_EXTERNAL_MODULE__bar_js_69b41beb__["default"] + typeof __WEBPACK_EXTERNAL_MODULE_prettier__["default"].version);
-    export { src_rslib_entry_ as default };
+    const src = __WEBPACK_EXTERNAL_MODULE_lodash__["default"].toUpper(__WEBPACK_EXTERNAL_MODULE__foo_js_fdf5aa2d__["default"] + __WEBPACK_EXTERNAL_MODULE__bar_js_69b41beb__["default"] + typeof __WEBPACK_EXTERNAL_MODULE_prettier__["default"].version);
+    export { src as default };
     "
   `);
 });
@@ -38,8 +38,8 @@ test('redirect.js.path false', async () => {
     import * as __WEBPACK_EXTERNAL_MODULE_prettier__ from "prettier";
     import * as __WEBPACK_EXTERNAL_MODULE__bar_js_69b41beb__ from "./bar.js";
     import * as __WEBPACK_EXTERNAL_MODULE__foo_js_fdf5aa2d__ from "./foo.js";
-    const src_rslib_entry_ = __WEBPACK_EXTERNAL_MODULE_lodash__["default"].toUpper(__WEBPACK_EXTERNAL_MODULE__foo_js_fdf5aa2d__["default"] + __WEBPACK_EXTERNAL_MODULE__bar_js_69b41beb__["default"] + typeof __WEBPACK_EXTERNAL_MODULE_prettier__["default"].version);
-    export { src_rslib_entry_ as default };
+    const src = __WEBPACK_EXTERNAL_MODULE_lodash__["default"].toUpper(__WEBPACK_EXTERNAL_MODULE__foo_js_fdf5aa2d__["default"] + __WEBPACK_EXTERNAL_MODULE__bar_js_69b41beb__["default"] + typeof __WEBPACK_EXTERNAL_MODULE_prettier__["default"].version);
+    export { src as default };
     "
   `);
 });
@@ -59,8 +59,8 @@ test('redirect.js.extension: false', async () => {
     import * as __WEBPACK_EXTERNAL_MODULE_prettier__ from "prettier";
     import * as __WEBPACK_EXTERNAL_MODULE__bar_js_69b41beb__ from "./bar.js";
     import * as __WEBPACK_EXTERNAL_MODULE__foo_23da6eef__ from "./foo";
-    const src_rslib_entry_ = __WEBPACK_EXTERNAL_MODULE_lodash__["default"].toUpper(__WEBPACK_EXTERNAL_MODULE__foo_23da6eef__["default"] + __WEBPACK_EXTERNAL_MODULE__bar_js_69b41beb__["default"] + typeof __WEBPACK_EXTERNAL_MODULE_prettier__["default"].version);
-    export { src_rslib_entry_ as default };
+    const src = __WEBPACK_EXTERNAL_MODULE_lodash__["default"].toUpper(__WEBPACK_EXTERNAL_MODULE__foo_23da6eef__["default"] + __WEBPACK_EXTERNAL_MODULE__bar_js_69b41beb__["default"] + typeof __WEBPACK_EXTERNAL_MODULE_prettier__["default"].version);
+    export { src as default };
     "
   `);
 });
diff --git a/tests/integration/shims/index.test.ts b/tests/integration/shims/index.test.ts
index ce0669af3..3acdb8451 100644
--- a/tests/integration/shims/index.test.ts
+++ b/tests/integration/shims/index.test.ts
@@ -13,7 +13,7 @@ describe('ESM shims', async () => {
   test('__dirname', async () => {
     for (const shim of [
       'import { fileURLToPath as __webpack_fileURLToPath__ } from "node:url";',
-      'var src_rslib_entry_dirname = __webpack_dirname__(__webpack_fileURLToPath__(import.meta.url));',
+      'var src_dirname = __webpack_dirname__(__webpack_fileURLToPath__(import.meta.url));',
     ]) {
       expect(entries.esm0).toContain(shim);
     }
@@ -26,7 +26,7 @@ describe('ESM shims', async () => {
   test('__filename', async () => {
     for (const shim of [
       'import { fileURLToPath as __webpack_fileURLToPath__ } from "node:url";',
-      'var src_rslib_entry_filename = __webpack_fileURLToPath__(import.meta.url);',
+      'var src_filename = __webpack_fileURLToPath__(import.meta.url);',
     ]) {
       expect(entries.esm0).toContain(shim);
     }
@@ -110,12 +110,12 @@ describe('CJS shims', () => {
       "import * as __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__ from "node:module";
       import * as __WEBPACK_EXTERNAL_MODULE_url__ from "url";
       const importMetaUrl = import.meta.url;
-      const src_rslib_entry_require = (0, __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__.createRequire)(import.meta.url);
-      const requiredModule = src_rslib_entry_require('./ok.cjs');
-      const src_rslib_entry_filename = (0, __WEBPACK_EXTERNAL_MODULE_url__.fileURLToPath)(import.meta.url);
-      console.log(src_rslib_entry_filename);
-      const src_rslib_entry_module = null;
-      export { src_rslib_entry_filename as __filename, importMetaUrl, src_rslib_entry_module as module, requiredModule };
+      const src_require = (0, __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__.createRequire)(import.meta.url);
+      const requiredModule = src_require('./ok.cjs');
+      const src_filename = (0, __WEBPACK_EXTERNAL_MODULE_url__.fileURLToPath)(import.meta.url);
+      console.log(src_filename);
+      const src_module = null;
+      export { src_filename as __filename, importMetaUrl, src_module as module, requiredModule };
       "
     `);
   });
diff --git a/tests/integration/style/stylus/index.test.ts b/tests/integration/style/stylus/index.test.ts
index 60a489e02..44df1f97b 100644
--- a/tests/integration/style/stylus/index.test.ts
+++ b/tests/integration/style/stylus/index.test.ts
@@ -92,7 +92,7 @@ test('should extract css with pluginStylus in bundle-false', async () => {
   expectFileContainContent(
     jsContents.esm,
     'assets/logo.js',
-    'import logo_rslib_entry_namespaceObject from "../static/svg/logo.svg"',
+    'import logo_namespaceObject from "../static/svg/logo.svg"',
   );
   expectFileContainContent(
     jsContents.esm,
diff --git a/website/docs/en/guide/advanced/static-assets.mdx b/website/docs/en/guide/advanced/static-assets.mdx
index ea8b44c4d..81a496a37 100644
--- a/website/docs/en/guide/advanced/static-assets.mdx
+++ b/website/docs/en/guide/advanced/static-assets.mdx
@@ -65,9 +65,9 @@ Based on the configuration in the [output structure](/guide/basic/output-structu
   <Tab label="dist/index.mjs">
 
 ```tsx
-import logo_rslib_entry_namespaceObject from './static/svg/logo.svg';
+import logo_namespaceObject from './static/svg/logo.svg';
 
-console.log(logo_rslib_entry_namespaceObject);
+console.log(logo_namespaceObject);
 ```
 
   </Tab>
@@ -92,8 +92,8 @@ console.log(logo);
   <Tab label="dist/assets/logo.mjs">
 
 ```tsx
-import logo_rslib_entry_namespaceObject from '../static/svg/logo.svg';
-export { logo_rslib_entry_namespaceObject as default };
+import logo_namespaceObject from '../static/svg/logo.svg';
+export { logo_namespaceObject as default };
 ```
 
   </Tab>
diff --git a/website/docs/zh/guide/advanced/static-assets.mdx b/website/docs/zh/guide/advanced/static-assets.mdx
index 77096a586..16ec47c61 100644
--- a/website/docs/zh/guide/advanced/static-assets.mdx
+++ b/website/docs/zh/guide/advanced/static-assets.mdx
@@ -65,9 +65,9 @@ console.log(logo);
   <Tab label="dist/index.mjs">
 
 ```tsx
-import logo_rslib_entry_namespaceObject from './static/svg/logo.svg';
+import logo_namespaceObject from './static/svg/logo.svg';
 
-console.log(logo_rslib_entry_namespaceObject);
+console.log(logo_namespaceObject);
 ```
 
   </Tab>
@@ -92,8 +92,8 @@ console.log(logo);
   <Tab label="dist/assets/logo.mjs">
 
 ```tsx
-import logo_rslib_entry_namespaceObject from '../static/svg/logo.svg';
-export { logo_rslib_entry_namespaceObject as default };
+import logo_namespaceObject from '../static/svg/logo.svg';
+export { logo_namespaceObject as default };
 ```
 
   </Tab>


Reviews:
user: login: Timeless0911
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-03T06:06:25Z
user: login: fi3ework
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-03T08:46:22Z
user: login: Timeless0911
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-04-03T09:01:12Z

Review comments:
diff_hunk: @@ -1126,7 +1122,8 @@ const composeEntryConfig = async (
       rspack: {
         entry: async () => {
           const { resolvedEntries } = await scanGlobEntries(false);
-          return appendEntryQuery(resolvedEntries);
+          // return appendEntryQuery(resolvedEntries);
path: packages/core/src/config.ts
user: login: Timeless0911
body: can be removed
created_at: 2025-04-03T06:06:25Z
author_association: CONTRIBUTOR
diff_hunk: @@ -1126,7 +1122,8 @@ const composeEntryConfig = async (
       rspack: {
         entry: async () => {
           const { resolvedEntries } = await scanGlobEntries(false);
-          return appendEntryQuery(resolvedEntries);
+          // return appendEntryQuery(resolvedEntries);
path: packages/core/src/config.ts
user: login: fi3ework
body: ```suggestion
```
created_at: 2025-04-03T08:46:16Z
author_association: MEMBER

PR comments:
user: login: netlify[bot]
created_at: 2025-04-03T03:24:37Z
body: ### <span aria-hidden="true">✅</span> Deploy Preview for *rslib* ready!


|  Name | Link |
|:-:|------------------------|
|<span aria-hidden="true">🔨</span> Latest commit | 213dd67afde491970fffb3f0b7b55b7ec75580b8 |
|<span aria-hidden="true">🔍</span> Latest deploy log | https://app.netlify.com/sites/rslib/deploys/67edff19d83e2b0009e9f79e |
|<span aria-hidden="true">😎</span> Deploy Preview | [https://deploy-preview-896--rslib.netlify.app](https://deploy-preview-896--rslib.netlify.app) |
|<span aria-hidden="true">📱</span> Preview on mobile | <details><summary> Toggle QR Code... </summary><br /><br />![QR Code](https://app.netlify.com/qr-code/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1cmwiOiJodHRwczovL2RlcGxveS1wcmV2aWV3LTg5Ni0tcnNsaWIubmV0bGlmeS5hcHAifQ.5J7wahrc9qDhcJjEeYTsRXj3n8l4VPSY0ivrw8WQvX8)<br /><br />_Use your smartphone camera to open QR code link._</details> |
---
<!-- [rslib Preview](https://deploy-preview-896--rslib.netlify.app) -->
_To edit notification comments on pull requests, go to your [Netlify site configuration](https://app.netlify.com/sites/rslib/configuration/notifications#deploy-webhooks)._
author_association: NONE
user: login: fi3ework
created_at: 2025-04-03T08:48:08Z
body: This PR turns out doesn't resolve multiple entry modules issue which behaves the same as entry query solution when entry module is circular dependented. But this's way better than entry query solution.
author_association: MEMBER
user: login: fi3ework
created_at: 2025-04-03T09:07:47Z
body: https://github.com/web-infra-dev/rslib/issues/316 is still not resolved in fact (just workaround for now).
author_association: MEMBER