webpack: Generalize debug-require-webpack-plugin interface.

Now the caller simply imports the debug ‘require’ function as a
module, deciding for itself how to expose it and with what name (in
our case, we expose it as ‘require’ with expose-loader).  Also, remove
a stray console.log.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg
2020-02-24 23:18:50 -08:00
committed by Tim Abbott
parent 60b5d372f9
commit b474fa0e37
4 changed files with 44 additions and 24 deletions

11
tools/debug-require.js Normal file
View File

@@ -0,0 +1,11 @@
/* global __webpack_require__ */
function debugRequire(request) {
return __webpack_require__(debugRequire.ids[request]);
}
debugRequire.initialize = function (ids) {
debugRequire.ids = ids;
};
module.exports = debugRequire;