-
-
Notifications
You must be signed in to change notification settings - Fork 783
Closed
Closed
Copy link
Description
System Info
Rspack 1.2.5
Details
When an app file to bundle is code-generated like that:
await fs.promises.writeFile(
"./src/dynamicFile.js",
`export const dynamic = 42`,
);
Then Rspack persistent cache will not work as expected: the JS loader will run again on subsequent app compilations.
This also happens when using this.addDependency("./dynamicFile.js")"
in a loader.
This differs from Webpack 5 behavior which will cache the file and skip reloading it.
Reproduce link
Reproduce Steps
Check code on repro/PR: slorber/rspack-cache-repro#1
You can run it with yarn install && yarn test
Here's the console output printing the extra unwanted loader runs
###############################################
# USING WEBPACK
#############
##########
Bundle App start
- Loading src/entry.js
- Loading src/file.js
- Loading src/dynamicFile.js
Bundle App: 2.146s
##########
Bundle App start
Bundle App: 5.507ms
##########
Bundle App start
Bundle App: 4.528ms
###############################################
# USING RSPACK
#############
##########
Bundle App start
- Loading src/entry.js
- Loading src/file.js
- Loading src/dynamicFile.js
Bundle App: 2.032s
##########
Bundle App start
- Loading src/dynamicFile.js ===========> BAD
Bundle App: 1.009s
##########
Bundle App start
- Loading src/dynamicFile.js ===========> BAD
Bundle App: 1.006s
cc @hardfist @jerrykingxyz as requested on Discord
Metadata
Metadata
Assignees
Labels
No labels