debug-require: Remove ES6 syntax.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2020-07-29 15:26:51 -07:00
parent 2d8ed545d4
commit 9e215093ca
2 changed files with 7 additions and 3 deletions

View File

@ -347,7 +347,11 @@
} }
}, },
{ {
"files": ["frontend_tests/casper_lib/**", "frontend_tests/casper_tests/**"], "files": [
"frontend_tests/casper_lib/**",
"frontend_tests/casper_tests/**",
"tools/debug-require.js"
],
"env": { "env": {
"browser": true, "browser": true,
"es2020": false "es2020": false

View File

@ -1,12 +1,12 @@
/* global __webpack_require__ */ /* global __webpack_require__ */
let webpackModules; var webpackModules;
function debugRequire(request) { function debugRequire(request) {
if (!Object.prototype.hasOwnProperty.call(debugRequire.ids, request)) { if (!Object.prototype.hasOwnProperty.call(debugRequire.ids, request)) {
throw new Error("Cannot find module '" + request + "'"); throw new Error("Cannot find module '" + request + "'");
} }
const moduleId = debugRequire.ids[request]; var moduleId = debugRequire.ids[request];
if (!Object.prototype.hasOwnProperty.call(webpackModules, moduleId)) { if (!Object.prototype.hasOwnProperty.call(webpackModules, moduleId)) {
throw new Error("Module '" + request + "' has not been loaded yet"); throw new Error("Module '" + request + "' has not been loaded yet");
} }