Skip to content

[Bug]: rspack-split-chunk bug with webpackExports magic comments #11583

@zhangyuang

Description

@zhangyuang

System Info

System:
OS: macOS 15.5
CPU: (14) arm64 Apple M4 Pro
Memory: 4.90 GB / 48.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 24.5.0 - ~/.nvm/versions/node/v24.5.0/bin/node
Yarn: 1.22.22 - ~/.nvm/versions/node/v24.5.0/bin/yarn
npm: 11.5.1 - ~/.nvm/versions/node/v24.5.0/bin/npm
pnpm: 10.15.1 - ~/.nvm/versions/node/v24.5.0/bin/pnpm
Browsers:
Chrome: 140.0.7339.80
Safari: 18.5
npmPackages:
@rspack/cli: ^1.4.11 => 1.4.11
@rspack/core: ^1.4.11 => 1.4.11
@rspack/plugin-react-refresh: ^1.4.3 => 1.4.3

Details

When I use magic comments with webpackChunkName and webpackExports together, it cannot generate the correct chunk name.

For the code below, the webpackChunkName can't take effect.

const foo = () => import(
		/*webpackChunkName: "foo"*/
		/*webpackExports: "default"*/
		'./foo')

Reproduce link

https://github.com/zhangyuang/rspack-bug-splitchunk/tree/bug/webpackExports

Reproduce Steps

# yarn && npm run build && ls dist
787.js       787.js.map   index.html   main.css     main.css.map main.js      main.js.map

There will generate 787.js instead of foo.js

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions