Merge pull request #10424 from lcy930323/bugfix/missing_module_template
fix(template): Syntax error caused by runtime template
This commit is contained in:
commit
d0a33e41c9
|
@ -137,7 +137,7 @@ class RuntimeTemplate {
|
|||
* @returns {string} generated error IIFE
|
||||
*/
|
||||
missingModule({ request }) {
|
||||
return `!(${this.throwMissingModuleErrorFunction({ request })}())`;
|
||||
return `Object(${this.throwMissingModuleErrorFunction({ request })}())`;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = [
|
||||
[/Module not found/, /Can't resolve '\.\/someModule' /],
|
||||
];
|
|
@ -0,0 +1,11 @@
|
|||
|
||||
|
||||
it("should have correct error code", function() {
|
||||
|
||||
try {
|
||||
require("./module");
|
||||
} catch(e) {
|
||||
expect(e.code).toBe("MODULE_NOT_FOUND");
|
||||
}
|
||||
|
||||
});
|
|
@ -0,0 +1,3 @@
|
|||
import { SomeClass } from "./someModule";
|
||||
|
||||
new SomeClass();
|
Loading…
Reference in New Issue