From 5552be141291f04f060ad216b820430c7baaaad5 Mon Sep 17 00:00:00 2001 From: Tilman Vatteroth Date: Fri, 17 Feb 2023 18:02:35 +0100 Subject: [PATCH] fix(bundle): force esbuild-loader to use cjs instead of iife Beginning with esbuild-loader 3 it uses iife for web bundles to avoid pollution of the "window" object. However, this broke our prod bundle because some variables should go into the global namespace. See https://github.com/esbuild-kit/esbuild-loader/releases/tag/v3.0.0 Signed-off-by: Tilman Vatteroth --- webpack.prod.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/webpack.prod.js b/webpack.prod.js index 2deb0ece2..5a7914798 100644 --- a/webpack.prod.js +++ b/webpack.prod.js @@ -17,6 +17,7 @@ module.exports = [ minimizer: [ new EsbuildPlugin({ target: 'es2015', + format: "cjs", exclude: ['MathJax/extensions/a11y/mathmaps'] }) ], @@ -31,7 +32,8 @@ module.exports = [ optimization: { minimizer: [ new EsbuildPlugin({ - target: 'es2015' + target: 'es2015', + format: "cjs" }), new OptimizeCSSAssetsPlugin({}) ]