From 953478a18908d77e9901e24bebe9fbe99c968774 Mon Sep 17 00:00:00 2001 From: rht Date: Sat, 20 Jan 2018 04:17:28 +0000 Subject: [PATCH] katex: Update the `require` path to point to the new one. This fixes #7620. --- static/third/katex/cli.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/static/third/katex/cli.js b/static/third/katex/cli.js index f112603b43..592ee72e89 100644 --- a/static/third/katex/cli.js +++ b/static/third/katex/cli.js @@ -36,7 +36,15 @@ SOFTWARE. let katex; try { // Attempt to import KaTeX from the production bundle - katex = require("/home/zulip/prod-static/min/katex.js"); + const paths = require('/home/zulip/deployments/current/staticfiles.json').paths.values(); + var katexPath = paths[paths.lastIndexOf('webpack-bundles/katex-')]; + if (!katexPath.endsWith('js')) { + // This is to anticipate that the webpack staticfiles ordering may not be + // deterministic, that katex-somehash.js.map gets selected instead of + // katex-somehash.js + katexPath = paths[paths.indexOf('webpack-bundles/katex-')]; + } + katex = require('/home/zulip/prod-static/' + katexPath); } catch (ex) { // Import KaTeX from node_modules (development environment) otherwise katex = require("../../node_modules/katex/dist/katex.js");