You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is highly related with the current loader impl.
Normally, webpack loaders, in a single loader pipeline, share the same loader context with loaders in both pitching and normal stage. That is said the LoaderContext["data"] is shared as well. In rspack, after the pitching loader, the JavaScript loader runner will yield and give control back to Rust loader runner to load resources (loader runner's process_resource hook). This results in the data being lost.
I found this issue when using the cache-loader, it is not urgent. If we can solve this issue, Rspack users can use cache-loader to speed up rebuild, which will be a practical approach before we support portable cache.
Yes, we have to resolve this issue. Roughly speaking, the rust LoaderItem(i.e. the LoaderObject counterpart in webpack) is immutable. To make it work with LoaderContext["data"], we need to change it to mutable and pass loader object with data instead of passing loader identifiers (upon which we create LoaderObject in loader runner on JS side) to JS to solve this issue.
System Info
System:
OS: macOS 13.6.6
CPU: (10) arm64 Apple M1 Pro
Memory: 2.56 GB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Yarn: 1.22.19 - ~/Library/Application Support/fnm/node-versions/v18.19.0/installation/bin/yarn
npm: 10.2.3 - ~/Library/Application Support/fnm/node-versions/v18.19.0/installation/bin/npm
pnpm: 7.18.1 - ~/Library/Application Support/fnm/node-versions/v18.19.0/installation/bin/pnpm
bun: 1.0.30 - ~/.bun/bin/bun
Browsers:
Chrome: 124.0.6367.119
Safari: 16.6
npmPackages:
@rspack/cli: ^0.6.3 => 0.6.3
@rspack/core: ^0.6.3 => 0.6.3
Details
Can not read
loaderContext.data
when using pitch loader.For example, create a simple pitch loader and set
loaderContext.data
:This seems to be a problem with the execution order of the pitch loaders in Rspack, causing data to not be set to the correct loader object.
Reproduce link
https://github.com/chenjiahan/rspack-repro-pitch-loader-data
Reproduce Steps
The text was updated successfully, but these errors were encountered: