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 <git@tilmanvatteroth.de>
This commit is contained in:
Tilman Vatteroth 2023-02-17 18:02:35 +01:00
parent 8efbb059e2
commit 5552be1412

View file

@ -17,6 +17,7 @@ module.exports = [
minimizer: [ minimizer: [
new EsbuildPlugin({ new EsbuildPlugin({
target: 'es2015', target: 'es2015',
format: "cjs",
exclude: ['MathJax/extensions/a11y/mathmaps'] exclude: ['MathJax/extensions/a11y/mathmaps']
}) })
], ],
@ -31,7 +32,8 @@ module.exports = [
optimization: { optimization: {
minimizer: [ minimizer: [
new EsbuildPlugin({ new EsbuildPlugin({
target: 'es2015' target: 'es2015',
format: "cjs"
}), }),
new OptimizeCSSAssetsPlugin({}) new OptimizeCSSAssetsPlugin({})
] ]