-
-
Notifications
You must be signed in to change notification settings - Fork 616
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: persistent cache use lazy compilation restart failure (#8952)
- Loading branch information
1 parent
2cfa879
commit c1a29f4
Showing
6 changed files
with
96 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
tests/e2e/cases/lazy-compilation/persistent-cache/index.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { expect, test } from "@/fixtures"; | ||
|
||
test("should load success", async ({ page, rspack }) => { | ||
await page.getByText("Click me").click(); | ||
let component_count = await page.getByText("Component").count(); | ||
expect(component_count).toBe(1); | ||
|
||
const responsePromise = page.waitForResponse( | ||
response => | ||
response.url().includes("lazy-compilation-using") && | ||
response.request().method() === "GET", | ||
{ timeout: 5000 } | ||
); | ||
await rspack.reboot(); | ||
await page.reload(); | ||
await responsePromise; | ||
|
||
await page.getByText("Click me").click(); | ||
component_count = await page.getByText("Component").count(); | ||
expect(component_count).toBe(1); | ||
}); |
22 changes: 22 additions & 0 deletions
22
tests/e2e/cases/lazy-compilation/persistent-cache/rspack.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const rspack = require("@rspack/core"); | ||
|
||
/** @type { import('@rspack/core').RspackOptions } */ | ||
module.exports = { | ||
context: __dirname, | ||
entry: { | ||
main: ["./src/component.js", "./src/index.js"] | ||
}, | ||
stats: "none", | ||
mode: "production", | ||
plugins: [new rspack.HtmlRspackPlugin()], | ||
cache: true, | ||
experiments: { | ||
lazyCompilation: true, | ||
cache: { | ||
type: "persistent" | ||
} | ||
}, | ||
devServer: { | ||
hot: true | ||
} | ||
}; |
3 changes: 3 additions & 0 deletions
3
tests/e2e/cases/lazy-compilation/persistent-cache/src/component.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const button = document.createElement("button"); | ||
button.textContent = "Component"; | ||
document.body.appendChild(button); |
3 changes: 3 additions & 0 deletions
3
tests/e2e/cases/lazy-compilation/persistent-cache/src/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const button = document.createElement("button"); | ||
button.textContent = "Click me"; | ||
document.body.appendChild(button); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c1a29f4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Ecosystem CI detail: Open
c1a29f4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Benchmark detail: Open