-
-
Notifications
You must be signed in to change notification settings - Fork 600
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: unregistered case handler should not panic (#5330)
* fix: unregistered case handler should not panic * chore: add panic message
- Loading branch information
Showing
7 changed files
with
54 additions
and
13 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
1 change: 1 addition & 0 deletions
1
packages/rspack/tests/configCases/builtin-swc-loader/issue-5329/errors.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 @@ | ||
module.exports = [[/Helper not defined: \"unregisteredCase\"/]]; |
5 changes: 5 additions & 0 deletions
5
packages/rspack/tests/configCases/builtin-swc-loader/issue-5329/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,5 @@ | ||
it("should throw error instead of panic", () => { | ||
expect(() => require("./lib-entry")).toThrowError( | ||
/Helper not defined: \"unregisteredCase\"/ | ||
); | ||
}); |
2 changes: 2 additions & 0 deletions
2
packages/rspack/tests/configCases/builtin-swc-loader/issue-5329/lib-entry.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,2 @@ | ||
import { FooBar } from "./lib"; | ||
eval(FooBar); |
1 change: 1 addition & 0 deletions
1
packages/rspack/tests/configCases/builtin-swc-loader/issue-5329/lib.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 @@ | ||
module.exports = ""; |
20 changes: 20 additions & 0 deletions
20
packages/rspack/tests/configCases/builtin-swc-loader/issue-5329/webpack.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,20 @@ | ||
module.exports = { | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.js$/, | ||
loader: "builtin:swc-loader", | ||
options: { | ||
rspackExperiments: { | ||
import: [ | ||
{ | ||
libraryName: "./lib", | ||
customName: "./lib/{{ unregisteredCase member }}" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
] | ||
} | ||
}; |
1 change: 1 addition & 0 deletions
1
.../configCases/builtin-swc-loader/plugin-import/src/custom-name-tpl-nopanic/fooBar/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 @@ | ||
export default "FooBar"; |
ee0ed24
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