Skip to content

[Bug]: Dynamic common chunk imports entry module #8849

@SebastianStamm

Description

@SebastianStamm

Reproduction link or steps

https://repl.rolldown.rs/#eNp9ksFugzAMhl/FyoVWQlSadqLaaY+x7JCCodkSB0HYOiHefU6yUpi6SSBwYjvf/zuTaEQ5CU01Xgo/hH8S5S3ORcVh5WjwYOEJtO1c73dSFIfKWetIiv1R9pLCG9KcwcK4dpf1yD16TS1YpSlLWesMuz9yexSl70ecc6Fqq2nFsMSJIZ0MH8qMCE3vLASIGEqxQdiQZlfQH4J/OOOB90DzdCrzMmbvjKndJxWc0uh2BXxnZ4M+QY2NJnyO2zAnFdm1LGM4wktM5UQ1mvhdCnaTJABN3ehLeJHLjKTI2YqrW1K85nA4gD+zS9rgAAMarDzWcPqKq6fRe0fAD6rqDF6dQl8ucZ3XLFvSvJcUpHaqelctFm+DY31J5GYtyYtcUtTYBSup0sgUJUwzd0qNon0rp5Y4Nfglekp2l/D4APP2jqRRrjrdFv66JXwBYpTdHf8y2EDJ9UZ5HLyYvwE1dg2T

What is expected?

When executing the index entry file, the admin entry file should not be executed. Here is a repl link to how rollup correctly bundles the same code (4 chunks).

What is actually happening?

In this scenario, two entry files (index and admin) dynamically import a common module. The admin entry file also statically imports some downstream dependency. The bundler puts the statically imported downstream dependency into the admin entry file (see Chunk Graph in repl, or the output of the common module which includes an import from the admin chunk).

As a result, there is a dependency from the common module to the admin entry file. When executing the index entry file, the admin entry file is also executed.

System Info

System:
    OS: Windows 11 10.0.26200
    CPU: (20) x64 13th Gen Intel(R) Core(TM) i5-13600KF
    Memory: 42.69 GB / 63.84 GB
  Browsers:
    Chrome: 146.0.7680.80

Any additional comments?

I ran into this while upgrading to vite 8 and wondering why admin functionality was loaded from the user bundle.

Metadata

Metadata

Type

Priority

None yet

Effort

None yet

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions