debug: Remove debug from globals.

This is used rarely enough that it’s easier to document how to use it
as a non-global than to document the horrifying things that might go
wrong as a global.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2020-07-28 19:46:33 -07:00 committed by Tim Abbott
parent 226598edc4
commit 767ad1d90e
2 changed files with 4 additions and 12 deletions

View File

@ -1,15 +1,8 @@
/* eslint-disable no-console */ /* eslint-disable no-console */
/* WARNING: // This module is included from webpack in development mode. To access it from
// the browser console, run:
This file is only included when Django's DEBUG = True and your // var debug = require("./static/js/debug");
host is in INTERNAL_IPS.
Do not commit any code elsewhere which uses these functions.
They are for debugging use only.
The file may still be accessible under other circumstances, so do
not put sensitive information here. */
/* /*
debug.print_elapsed_time("foo", foo) debug.print_elapsed_time("foo", foo)

View File

@ -244,7 +244,6 @@ export default (env?: string): webpack.Configuration[] => {
// Good error messages show up in production and development in the source maps // Good error messages show up in production and development in the source maps
const exposeOptions = [ const exposeOptions = [
{path: "./debug-require.js", name: "require"}, {path: "./debug-require.js", name: "require"},
{path: "../static/js/debug.js"},
{path: "jquery/dist/jquery.js", name: ["$", "jQuery"]}, {path: "jquery/dist/jquery.js", name: ["$", "jQuery"]},
]; ];
config.module!.rules.unshift(...getExposeLoaders(exposeOptions)); config.module!.rules.unshift(...getExposeLoaders(exposeOptions));
@ -252,7 +251,7 @@ export default (env?: string): webpack.Configuration[] => {
if (!production) { if (!production) {
// Out JS debugging tools // Out JS debugging tools
for (const paths of Object.values(assets)) { for (const paths of Object.values(assets)) {
paths.push("./static/js/debug.js"); paths.push("./static/js/debug");
} }
config.devServer = { config.devServer = {
clientLogLevel: "error", clientLogLevel: "error",