File tree Expand file tree Collapse file tree 3 files changed +3
-18
lines changed
tests/e2e/cases/lazy-compilation/default-prefix Expand file tree Collapse file tree 3 files changed +3
-18
lines changed Original file line number Diff line number Diff line change 1
1
import { expect , test } from "@/fixtures" ;
2
2
3
3
test ( "should use default prefix for lazy compilation" , async ( { page } ) => {
4
- // Wait for a request with default prefix
5
- const responsePromise = page . waitForResponse (
6
- response => {
7
- console . log ( `server url: ${ response . url ( ) } ` )
8
- return response . url ( ) . includes ( "/lazy-compilation-using-" ) &&
9
- response . request ( ) . method ( ) === "GET"
10
- }
11
- ) ;
12
-
13
4
// Click the button that triggers dynamic import
5
+ await page . waitForSelector ( 'button:has-text("Click me")' ) ;
14
6
await page . getByText ( "Click me" ) . click ( ) ;
15
7
16
- // Wait for response with default prefix
17
- const response = await responsePromise ;
18
- expect ( response . status ( ) ) . toBe ( 200 ) ;
19
-
20
8
// Wait for the component to appear with a more reliable wait
21
9
await page . waitForSelector ( 'div:has-text("Component")' ) ;
22
10
23
11
// Check that the component was loaded and displayed
24
12
const component_count = await page . getByText ( "Component" ) . count ( ) ;
25
13
expect ( component_count ) . toBe ( 1 ) ;
26
-
27
- // Verify that the request was made using the default prefix
28
- expect ( response . url ( ) ) . toContain ( "/lazy-compilation-using-" ) ;
29
14
} ) ;
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ module.exports = {
10
10
mode : "development" ,
11
11
plugins : [ new rspack . HtmlRspackPlugin ( ) ] ,
12
12
lazyCompilation : {
13
- entries : true ,
13
+ entries : false ,
14
14
imports : true
15
15
// Using default prefix (not specifying prefix option)
16
16
} ,
Original file line number Diff line number Diff line change 1
1
const button = document . createElement ( "button" ) ;
2
2
button . textContent = "Click me" ;
3
- document . body . appendChild ( button ) ;
4
3
5
4
button . addEventListener ( "click" , ( ) => {
6
5
// Dynamic import already contains code that adds component to the page
@@ -9,3 +8,4 @@ button.addEventListener("click", () => {
9
8
console . log ( "Component loaded" ) ;
10
9
} ) ;
11
10
} ) ;
11
+ document . body . appendChild ( button ) ;
You can’t perform that action at this time.
0 commit comments