Skip to content

Minimize prod builds#7789

Open
jtpio wants to merge 5 commits intojupyter:mainfrom
jtpio:prod-builds
Open

Minimize prod builds#7789
jtpio wants to merge 5 commits intojupyter:mainfrom
jtpio:prod-builds

Conversation

@jtpio
Copy link
Copy Markdown
Member

@jtpio jtpio commented Dec 17, 2025

Fixes #7736
Closes #7748

Follow the JupyterLab approach.

  • Config to build in release mode
  • Measure bundle size on CI

@jtpio jtpio added this to the 7.6.0 milestone Dec 17, 2025
@github-actions
Copy link
Copy Markdown
Contributor

Binder 👈 Launch a Binder on branch jtpio/notebook/prod-builds

@jtpio jtpio marked this pull request as ready for review January 13, 2026 18:22
@jtpio
Copy link
Copy Markdown
Member Author

jtpio commented Jan 13, 2026

cc @HarkiratS1511 since you explored this in #7748

The approach may be slightly different since notebook has switched from webpack to Rspack (like JupyterLab).

@jtpio jtpio marked this pull request as draft January 23, 2026 07:57
@jtpio
Copy link
Copy Markdown
Member Author

jtpio commented Jan 28, 2026

CI will now report bundle sizes:

image

@jtpio jtpio marked this pull request as ready for review January 28, 2026 09:41
@jtpio jtpio requested a review from Copilot February 20, 2026 15:29
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Notebook frontend build pipeline to produce minified production assets (and optionally omit source maps for release builds), aligning with the approach used in JupyterLab, and adds CI reporting to track bundle size changes over time.

Changes:

  • Switch Python/package build hooks to use a new build:prod:release target for release-mode frontend builds.
  • Add new Rspack production configs for prod:minimize (minified + source maps) and prod:release (minified + no source maps), plus corresponding jlpm scripts.
  • Add a GitHub Actions job that builds and reports bundle sizes for dev vs prod:minimize vs prod:release in the workflow summary.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pyproject.toml Updates hatch/jupyter-builder and releaser hooks to use build:prod:release for packaged builds.
package.json Adds top-level build scripts to run minimized/release app builds while building other workspaces via lerna.
app/rspack.prod.minimize.config.js New prod config enabling optimization.minimize: true while keeping source maps.
app/rspack.prod.release.config.js New prod config layering “no source maps” on top of the minimized config.
app/package.json Adds app-local scripts to invoke the new Rspack configs.
.github/workflows/build.yml Adds a new bundle_size job that measures and reports JS and sourcemap sizes for different build modes.
.github/workflows/buildutils.yml Updates the jupyterlab prerelease lower-bound used in CI setup steps.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +6 to +12
const merge = require('webpack-merge').default;
const config = require('./rspack.prod.minimize.config');

config[0] = merge(config[0], {
// Turn off source maps
devtool: false,
});
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rspack.prod.release.config.js imports ./rspack.prod.minimize.config and then mutates config[0]. Because Node caches require() results, this also mutates the exported config from rspack.prod.minimize.config.js within the same process, which can lead to surprising behavior if both configs are ever loaded in one run (e.g., tooling/tests). Consider building the release config directly from ./rspack.config (or deep-cloning the minimize config) instead of requiring-and-mutating another config module.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These config files are not meant to be used simultaneously.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Published frontend assets are not minified

2 participants