do not error when using lazy-once

This commit is contained in:
Tobias Koppers 2022-03-15 16:34:05 +01:00
parent 5a9ead926a
commit ee6b53d821
1 changed files with 15 additions and 24 deletions

View File

@ -190,16 +190,22 @@ class ImportParserPlugin {
}
}
if (param.isString()) {
if (mode !== "lazy" && mode !== "eager" && mode !== "weak") {
parser.state.module.addWarning(
new UnsupportedFeatureWarning(
`\`webpackMode\` expected 'lazy', 'eager' or 'weak', but received: ${mode}.`,
expr.loc
)
);
}
if (
mode !== "lazy" &&
mode !== "lazy-once" &&
mode !== "eager" &&
mode !== "weak"
) {
parser.state.module.addWarning(
new UnsupportedFeatureWarning(
`\`webpackMode\` expected 'lazy', 'lazy-once', 'eager' or 'weak', but received: ${mode}.`,
expr.loc
)
);
mode = "lazy";
}
if (param.isString()) {
if (mode === "eager") {
const dep = new ImportEagerDependency(
param.string,
@ -230,21 +236,6 @@ class ImportParserPlugin {
}
return true;
} else {
if (
mode !== "lazy" &&
mode !== "lazy-once" &&
mode !== "eager" &&
mode !== "weak"
) {
parser.state.module.addWarning(
new UnsupportedFeatureWarning(
`\`webpackMode\` expected 'lazy', 'lazy-once', 'eager' or 'weak', but received: ${mode}.`,
expr.loc
)
);
mode = "lazy";
}
if (mode === "weak") {
mode = "async-weak";
}