Conversation
|
cc @HarkiratS1511 since you explored this in #7748 The approach may be slightly different since notebook has switched from webpack to Rspack (like JupyterLab). |
There was a problem hiding this comment.
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:releasetarget for release-mode frontend builds. - Add new Rspack production configs for
prod:minimize(minified + source maps) andprod:release(minified + no source maps), plus correspondingjlpmscripts. - 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.
| const merge = require('webpack-merge').default; | ||
| const config = require('./rspack.prod.minimize.config'); | ||
|
|
||
| config[0] = merge(config[0], { | ||
| // Turn off source maps | ||
| devtool: false, | ||
| }); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
These config files are not meant to be used simultaneously.

Fixes #7736
Closes #7748
Follow the JupyterLab approach.