Open 1yasa opened 1 month ago
By the way, this also may cause by pure esm(rspack handle pure esm is experimental).
Reproduce when use rollup(export LexicalNode instead of export type LexicalNode):
So question is, why rspack treat export type LexicalNode as a actually export, the rollup handle this case is right.
Tested export order, that may cause output same error, fixed by export * from ''.
But rspack still scope to be hoisted incorrectly.
@ahabhgk "same as webpack" It means that webpack is the same, so will it not be fixed?
No, it means we will fix it for both rspack and webpack
This is caused by circular imports and the case is very complex, so we may need more time to find the root issue and then fix it
Is there any progress?
System Info
System: OS: macOS 14.4 CPU: (32) x64 13th Gen Intel(R) Core(TM) i9-13900KF Memory: 12.73 GB / 32.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 21.6.1 - /usr/local/bin/node npm: 10.2.4 - /usr/local/bin/npm pnpm: 9.4.0 - /usr/local/bin/pnpm Watchman: 2024.06.10.00 - /usr/local/bin/watchman
Details
rspack build output used in app error:
location for error code:
class dependencie [LexicalNode] defind in the last bottom:
rollup build output [LexicalNode] in the top(before used):
I tried all possible configurations of swc and rspack, and finally concluded that this issue might be due to the omission of some scenarios of class scope hoisting.
It could also be a circular dependency causing the scope to be hoisted incorrectly.
Reproduce link
https://github.com/openages/lexical
Reproduce Steps
pnpm run rspack
for rspack build output.pnpm run build
for rollup build output.use "lexical":"workspace:*" in the monorepo/packages/app.
https://lexical.dev/docs/getting-started/quick-start