fix Errors for require.parent/main.require
This commit is contained in:
parent
782e4535ac
commit
66d7ebd9a8
|
@ -73,6 +73,15 @@ class CommonJsImportsParserPlugin {
|
|||
"require.main.require is not supported by webpack."
|
||||
)
|
||||
);
|
||||
parser.hooks.call
|
||||
.for("require.main.require")
|
||||
.tap(
|
||||
"CommonJsPlugin",
|
||||
expressionIsUnsupported(
|
||||
parser,
|
||||
"require.main.require is not supported by webpack."
|
||||
)
|
||||
);
|
||||
parser.hooks.expression
|
||||
.for("module.parent.require")
|
||||
.tap(
|
||||
|
@ -82,6 +91,15 @@ class CommonJsImportsParserPlugin {
|
|||
"module.parent.require is not supported by webpack."
|
||||
)
|
||||
);
|
||||
parser.hooks.call
|
||||
.for("module.parent.require")
|
||||
.tap(
|
||||
"CommonJsPlugin",
|
||||
expressionIsUnsupported(
|
||||
parser,
|
||||
"module.parent.require is not supported by webpack."
|
||||
)
|
||||
);
|
||||
|
||||
// renaming //
|
||||
parser.hooks.canRename.for("require").tap("CommonJsPlugin", () => true);
|
||||
|
|
|
@ -188,7 +188,7 @@ it("should emit warning for require.main.require", async () => {
|
|||
"errors": Array [],
|
||||
"warnings": Array [
|
||||
Object {
|
||||
"loc": "1:0-20",
|
||||
"loc": "1:0-30",
|
||||
"message": "require.main.require is not supported by webpack.",
|
||||
"moduleId": 0,
|
||||
"moduleIdentifier": "<cwd>/test/fixtures/errors/require.main.require.js",
|
||||
|
@ -207,7 +207,7 @@ it("should emit warning for module.parent.require", async () => {
|
|||
"errors": Array [],
|
||||
"warnings": Array [
|
||||
Object {
|
||||
"loc": "1:0-21",
|
||||
"loc": "1:0-31",
|
||||
"message": "module.parent.require is not supported by webpack.",
|
||||
"moduleId": 0,
|
||||
"moduleIdentifier": "<cwd>/test/fixtures/errors/module.parent.require.js",
|
||||
|
|
Loading…
Reference in New Issue