-
-
Notifications
You must be signed in to change notification settings - Fork 568
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: should generate correct context request with query (#6018)
- Loading branch information
1 parent
5dbba23
commit 70b2bd2
Showing
11 changed files
with
87 additions
and
16 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
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
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
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
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
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
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
57 changes: 57 additions & 0 deletions
57
packages/rspack/tests/cases/context/resource-query-prefix/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,57 @@ | ||
it("should detect query strings in dynamic import in sub directories by concat as a static value", function () { | ||
var testFileName = "a"; | ||
|
||
return Promise.all([ | ||
import(`./sub/${testFileName}`).then(({ default: a }) => { | ||
expect(a()).toBe("a"); | ||
}), | ||
import(`./sub/${testFileName}`).then(({ default: a }) => { | ||
expect(a()).toBe("a"); | ||
}), | ||
import(`./sub/${testFileName}bc`).then(({ default: a }) => { | ||
expect(a()).toBe("abc"); | ||
}), | ||
import(`./sub/${testFileName}?queryString`).then(({ default: a }) => { | ||
expect(a()).toBe("a?queryString"); | ||
}) | ||
]); | ||
}); | ||
|
||
it("should detect query strings in dynamic import in sub directories by template string as a static value", function () { | ||
var testFileName = "a"; | ||
|
||
return Promise.all([ | ||
import("./sub/".concat(testFileName)).then(({ default: a }) => { | ||
expect(a()).toBe("a"); | ||
}), | ||
import("./sub/".concat(testFileName).concat("")).then(({ default: a }) => { | ||
expect(a()).toBe("a"); | ||
}), | ||
import("./sub/".concat(testFileName).concat("bc")).then(({ default: a }) => { | ||
expect(a()).toBe("abc"); | ||
}), | ||
import("./sub/".concat(testFileName).concat("?queryString")).then(({ default: a }) => { | ||
expect(a()).toBe("a?queryString"); | ||
}) | ||
]); | ||
}); | ||
|
||
it("should detect query strings in dynamic import in sub directories by add as a static value", function () { | ||
var testFileName = "a"; | ||
|
||
return Promise.all([ | ||
import("./sub/" + testFileName).then(({ default: a }) => { | ||
expect(a()).toBe("a"); | ||
}), | ||
import("./sub/" + testFileName + "").then(({ default: a }) => { | ||
expect(a()).toBe("a"); | ||
}), | ||
import("./sub/" + testFileName + "bc").then(({ default: a }) => { | ||
expect(a()).toBe("abc"); | ||
}), | ||
import("./sub/" + testFileName + "?queryString").then(({ default: a }) => { | ||
expect(a()).toBe("a?queryString"); | ||
}) | ||
]); | ||
}); | ||
|
3 changes: 3 additions & 0 deletions
3
packages/rspack/tests/cases/context/resource-query-prefix/sub/a.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 @@ | ||
export default function a() { | ||
return "a" + __resourceQuery; | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/rspack/tests/cases/context/resource-query-prefix/sub/abc.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 @@ | ||
export default function abc() { | ||
return "abc" + __resourceQuery; | ||
} |
This file was deleted.
Oops, something went wrong.
70b2bd2
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.
📝 Ran ecosystem CI: Open
70b2bd2
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