Skip to content

[Bug]: Rspack dependOn not shares modules #10261

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
daief opened this issue Apr 30, 2025 · 1 comment · May be fixed by #10342
Open

[Bug]: Rspack dependOn not shares modules #10261

daief opened this issue Apr 30, 2025 · 1 comment · May be fixed by #10342
Assignees

Comments

@daief
Copy link

daief commented Apr 30, 2025

System Info

npx envinfo --system --npmPackages '@rspack/*' --binaries --browsers

  System:
    OS: Windows 10 10.0.19045
    CPU: (16) x64 Intel(R) Core(TM) i7-10700 CPU @ 2.90GHz
    Memory: 1.27 GB / 15.87 GB
  Binaries:
    Node: 20.18.3 - ~\scoop\apps\mise\current\mise\installs\node\20.18.3\node.EXE  
    Yarn: 1.22.22 - ~\scoop\apps\yarn\current\bin\yarn.CMD
    npm: 10.8.2 - ~\scoop\apps\mise\current\mise\installs\node\20.18.3\npm.CMD     
    bun: 1.2.4 - ~\scoop\apps\mise\current\mise\installs\bun\1.2.4\bin\bun.EXE     
  Browsers:
    Edge: Chromium (127.0.2651.74)
    Internet Explorer: 11.0.19041.4355
  npmPackages:
    @rspack/cli: ^1.3.8 => 1.3.8
    @rspack/core: ^1.3.8 => 1.3.8
    webpack: ^5.99.7 => 5.99.7

Details

I want to share the modules from one entry chunk to another with depondOn.

config.js:

module.exports = { 
  entry: {
    vendor1: {
      import: './src/vendor1.js',
    },
    vendor2: {
      import: './src/vendor2.js',
    },
    app: {
      import: './src/app.js',
      dependOn: ['vendor1', 'vendor2'],
    },
  }, 
};

But the result dist of Rspack do not share the modules in vendor:

  • left Rspack, result app.js includes all modules. And result vendor1 do not include pkg-a(b, c)'s code,
  • right Webpack, use modules from vendor as expected

Image

All details in Reproduce link

Reproduce link

https://github.com/daief/rspack-issues/tree/9100c38bae4f44103b418edcee62020a18a6bec0/issues/depend-on

Reproduce Steps

$ yarn
$ cd issues/depend-on
$ yarn build
@daief daief added the pending triage The issue/PR is currently untouched. label Apr 30, 2025
@LingyuCoder LingyuCoder self-assigned this May 6, 2025
@LingyuCoder LingyuCoder removed the pending triage The issue/PR is currently untouched. label May 6, 2025
@LingyuCoder
Copy link
Contributor

Seems to be a bug of new code splitting algorithm, you can try adding this to your config.js to fix it temporarily:

experiments: {
  parallelCodeSplitting: false
}

cc @JSerFeng

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants