hoist the deprecate function
This commit is contained in:
parent
74074a9b18
commit
ba90a1d20e
|
@ -9,6 +9,15 @@ const util = require("util");
|
|||
const ExternalModule = require("./ExternalModule");
|
||||
const UNSPECIFIED_EXTERNAL_TYPE_REGEXP = /^[a-z0-9]+ /;
|
||||
|
||||
// TODO webpack 6 remove this
|
||||
const callDeprecatedExternals = util.deprecate(
|
||||
(externalsFunction, context, request, cb) => {
|
||||
externalsFunction.call(null, context, request, cb);
|
||||
},
|
||||
"The externals-function should be defined like ({context, request}, cb) => { ... }",
|
||||
"DEP_WEBPACK_EXTERNALS_FUNCTION_PARAMETERS"
|
||||
);
|
||||
|
||||
class ExternalModuleFactoryPlugin {
|
||||
constructor(type, externals) {
|
||||
this.type = type;
|
||||
|
@ -106,15 +115,12 @@ class ExternalModuleFactoryPlugin {
|
|||
};
|
||||
if (externals.length === 3) {
|
||||
// TODO webpack 6 remove this
|
||||
util
|
||||
.deprecate(
|
||||
(context, request, cb) => {
|
||||
externals.call(null, context, dependency.request, cb);
|
||||
},
|
||||
"The externals-function should be defined like ({context, request}, cb) => { ... }",
|
||||
"DEP_WEBPACK_EXTERNALS_FUNCTION_PARAMETERS"
|
||||
)
|
||||
.call(null, context, dependency.request, cb);
|
||||
callDeprecatedExternals(
|
||||
externals,
|
||||
context,
|
||||
dependency.request,
|
||||
cb
|
||||
);
|
||||
} else {
|
||||
externals(
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue