From bcb2e32b6b287d1113351d076d36dd042d8a99af Mon Sep 17 00:00:00 2001 From: Harkirat Sandhu Date: Sat, 18 Oct 2025 18:45:22 +1100 Subject: [PATCH 1/2] Enable minification in production builds Fixes #7736 - Changed minimize: false to minimize: true in webpack.prod.config.js - This should reduce asset size from ~63MB to ~17MB - Matches JupyterLab's optimized build approach --- app/webpack.prod.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/webpack.prod.config.js b/app/webpack.prod.config.js index db7e6dfdb5..7ac0a2185e 100644 --- a/app/webpack.prod.config.js +++ b/app/webpack.prod.config.js @@ -16,7 +16,7 @@ config[0] = merge(config[0], { filename: '[name].[contenthash].js?v=[contenthash]', }, optimization: { - minimize: false, + minimize: true, }, plugins: [ new WPPlugin.JSONLicenseWebpackPlugin({ From 685af54dcd7f57ec9df8194efcd401f613df0a92 Mon Sep 17 00:00:00 2001 From: Harkirat Sandhu Date: Wed, 22 Oct 2025 18:51:30 +1100 Subject: [PATCH 2/2] Add TerserPlugin configuration from JupyterLab Copied terser configuration from JupyterLab to optimize both JS and source maps. Unable to test locally due to lib0/TypeScript compatibility issues, relying on CI for validation. --- app/webpack.prod.config.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/app/webpack.prod.config.js b/app/webpack.prod.config.js index 7ac0a2185e..aaae8b1022 100644 --- a/app/webpack.prod.config.js +++ b/app/webpack.prod.config.js @@ -6,6 +6,8 @@ const merge = require('webpack-merge').default; const config = require('./webpack.config'); const WPPlugin = require('@jupyterlab/builder').WPPlugin; +const TerserPlugin = require('terser-webpack-plugin'); + config[0] = merge(config[0], { mode: 'production', @@ -16,8 +18,23 @@ config[0] = merge(config[0], { filename: '[name].[contenthash].js?v=[contenthash]', }, optimization: { - minimize: true, - }, + minimize: true, + minimizer: [ + new TerserPlugin({ + parallel: true, + terserOptions: { + compress: false, + ecma: 6, + mangle: true, + output: { + beautify: false, + comments: false + }, + safari10: true + } + }) + ] +}, plugins: [ new WPPlugin.JSONLicenseWebpackPlugin({ excludedPackageTest: (packageName) =>