DEV: Deprecation warning for aliased module usage (#8341)

This commit is contained in:
Mark VanLandingham 2019-11-12 10:20:14 -06:00 committed by GitHub
parent cf4356cd81
commit 213ebc3b32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -140,6 +140,15 @@ var define, requirejs;
);
}
function deprecatedModule(depricated, useInstead) {
let warning = "[DEPRECATION] `" + depricated + "` is deprecated.";
if (useInstead) {
warning += " Please use `" + useInstead + "` instead.";
}
// eslint-disable-next-line no-console
console.warn(warning);
}
var defaultDeps = ["require", "exports", "module"];
function Module(name, deps, callback, exports) {
@ -243,7 +252,11 @@ var define, requirejs;
}
function transformForAliases(name) {
return ALIASES[name] ? ALIASES[name] : name;
let alias = ALIASES[name];
if (!alias) return name;
deprecatedModule(name, alias);
return alias;
}
requirejs = require = function(name) {