Skip to content

Build: Stop minifying build output #32092

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jul 23, 2025
Merged

Build: Stop minifying build output #32092

merged 7 commits into from
Jul 23, 2025

Conversation

JReinhold
Copy link
Contributor

@JReinhold JReinhold commented Jul 21, 2025

Works on #31787

What I did

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli-storybook/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>

Greptile Summary

This PR implements a build system change to stop minifying the output across the entire Storybook monorepo. The primary changes involve modifying build scripts (scripts/build/build-package.ts and scripts/build/utils/generate-bundle.ts) to disable minification during the bundling process. As a result of these build system modifications, all 40+ package.json files across the monorepo have been automatically updated with new gitHead commit hashes that reference the commit containing the minification changes.

The change represents a shift in philosophy toward prioritizing developer experience over minimal bundle sizes. By removing minification, the distributed Storybook code will be more readable and easier to debug, which is particularly valuable for a development tool where users may need to inspect generated code or troubleshoot issues. The trade-off is larger bundle sizes, but this is acceptable for development tooling where debuggability is more important than size optimization.

Additionally, some packages show simplified export structures moving from conditional exports (import/require) to single default exports, and the addition of "type": "module" in some files, which aligns with the target branch sb10/esm-only indicating a broader transition to ESM-only distribution.

The gitHead field updates are automated metadata changes that occur during the build process to track which specific Git commit was used to generate each package, ensuring proper version tracking and build reproducibility across the monorepo.

Confidence score: 5/5

• This PR is very safe to merge as it only affects build tooling and package metadata without changing any functional code or APIs
• The changes are internal build optimizations that improve debugging experience with no breaking changes to public interfaces
• All changed files require minimal attention as they contain only automated gitHead updates and build configuration modifications

@JReinhold JReinhold added maintenance User-facing maintenance tasks ci:normal labels Jul 21, 2025
@JReinhold JReinhold self-assigned this Jul 21, 2025
Copy link

nx-cloud bot commented Jul 21, 2025

View your CI Pipeline Execution ↗ for commit d91f948

Command Status Duration Result
nx run-many -t build --parallel=3 ✅ Succeeded 1m 52s View ↗

☁️ Nx Cloud last updated this comment at 2025-07-23 07:33:51 UTC

@storybook-pr-benchmarking
Copy link

storybook-pr-benchmarking bot commented Jul 22, 2025

Package Benchmarks

Commit: d91f948, ran on 23 July 2025 at 07:18:53 UTC

The following packages have significant changes to their size or dependencies:

@storybook/addon-a11y

Before After Difference
Dependency count 2 2 0
Self size 348 KB 508 KB 🚨 +160 KB 🚨
Dependency size 2.80 MB 2.80 MB 0 B
Bundle Size Analyzer browser node browser node

@storybook/addon-docs

Before After Difference
Dependency count 13 13 0
Self size 1.46 MB 2.01 MB 🚨 +552 KB 🚨
Dependency size 9.00 MB 9.01 MB 🚨 +4 KB 🚨
Bundle Size Analyzer browser node browser node

@storybook/addon-jest

Before After Difference
Dependency count 2 2 0
Self size 34 KB 46 KB 🚨 +12 KB 🚨
Dependency size 53 KB 53 KB 0 B
Bundle Size Analyzer browser browser

@storybook/addon-links

Before After Difference
Dependency count 1 1 0
Self size 13 KB 15 KB 🚨 +2 KB 🚨
Dependency size 5 KB 5 KB 0 B
Bundle Size Analyzer browser browser

@storybook/addon-onboarding

Before After Difference
Dependency count 0 0 0
Self size 236 KB 332 KB 🚨 +96 KB 🚨
Dependency size 667 B 667 B 0 B
Bundle Size Analyzer browser node browser node

storybook-addon-pseudo-states

Before After Difference
Dependency count 0 0 0
Self size 16 KB 23 KB 🚨 +7 KB 🚨
Dependency size 686 B 686 B 0 B
Bundle Size Analyzer browser browser

@storybook/addon-themes

Before After Difference
Dependency count 1 1 0
Self size 16 KB 20 KB 🚨 +4 KB 🚨
Dependency size 28 KB 28 KB 0 B
Bundle Size Analyzer browser node browser node

@storybook/addon-vitest

Before After Difference
Dependency count 6 6 0
Self size 584 KB 857 KB 🚨 +273 KB 🚨
Dependency size 1.49 MB 1.49 MB 0 B
Bundle Size Analyzer browser node browser node

@storybook/builder-vite

Before After Difference
Dependency count 6 6 0
Self size 280 KB 374 KB 🚨 +95 KB 🚨
Dependency size 910 KB 911 KB 🚨 +1 KB 🚨
Bundle Size Analyzer node node

@storybook/builder-webpack5

Before After Difference
Dependency count 186 186 0
Self size 55 KB 67 KB 🚨 +13 KB 🚨
Dependency size 31.24 MB 31.24 MB 🚨 +2 KB 🚨
Bundle Size Analyzer node node

storybook

Before After Difference
Dependency count 54 54 0
Self size 23.66 MB 30.62 MB 🚨 +6.96 MB 🚨
Dependency size 19.25 MB 19.25 MB 0 B
Bundle Size Analyzer browser globalized-runtime node runtime browser globalized-runtime node runtime

@storybook/angular

Before After Difference
Dependency count 185 185 0
Self size 107 KB 133 KB 🚨 +27 KB 🚨
Dependency size 29.36 MB 29.37 MB 🚨 +15 KB 🚨
Bundle Size Analyzer browser node browser node

@storybook/ember

Before After Difference
Dependency count 191 191 0
Self size 15 KB 16 KB 🚨 +1 KB 🚨
Dependency size 27.95 MB 27.96 MB 🚨 +15 KB 🚨
Bundle Size Analyzer browser node browser node

@storybook/html-vite

Before After Difference
Dependency count 9 9 0
Self size 23 KB 23 KB 🚨 +243 B 🚨
Dependency size 1.22 MB 1.32 MB 🚨 +97 KB 🚨
Bundle Size Analyzer browser node browser node

@storybook/nextjs

Before After Difference
Dependency count 529 529 0
Self size 657 KB 926 KB 🚨 +269 KB 🚨
Dependency size 57.72 MB 58.02 MB 🚨 +298 KB 🚨
Bundle Size Analyzer browser node browser node

@storybook/nextjs-vite

Before After Difference
Dependency count 130 130 0
Self size 3.04 MB 4.00 MB 🚨 +959 KB 🚨
Dependency size 21.03 MB 21.41 MB 🚨 +375 KB 🚨
Bundle Size Analyzer browser node browser node

@storybook/preact-vite

Before After Difference
Dependency count 9 9 0
Self size 13 KB 14 KB 🚨 +297 B 🚨
Dependency size 1.21 MB 1.31 MB 🚨 +97 KB 🚨
Bundle Size Analyzer browser node browser node

@storybook/react-native-web-vite

Before After Difference
Dependency count 161 161 0
Self size 33 KB 34 KB 🚨 +1 KB 🚨
Dependency size 22.35 MB 22.73 MB 🚨 +375 KB 🚨
Bundle Size Analyzer browser node browser node

@storybook/react-vite

Before After Difference
Dependency count 120 120 0
Self size 33 KB 36 KB 🚨 +2 KB 🚨
Dependency size 18.98 MB 19.35 MB 🚨 +373 KB 🚨
Bundle Size Analyzer browser node browser node

@storybook/react-webpack5

Before After Difference
Dependency count 272 272 0
Self size 24 KB 25 KB 🚨 +504 B 🚨
Dependency size 42.59 MB 42.89 MB 🚨 +298 KB 🚨
Bundle Size Analyzer browser node browser node

@storybook/server-webpack5

Before After Difference
Dependency count 198 198 0
Self size 16 KB 17 KB 🚨 +319 B 🚨
Dependency size 32.47 MB 32.49 MB 🚨 +18 KB 🚨
Bundle Size Analyzer browser node browser node

@storybook/svelte-vite

Before After Difference
Dependency count 18 18 0
Self size 52 KB 57 KB 🚨 +6 KB 🚨
Dependency size 25.80 MB 25.90 MB 🚨 +101 KB 🚨
Bundle Size Analyzer browser node browser node

@storybook/sveltekit

Before After Difference
Dependency count 19 19 0
Self size 44 KB 48 KB 🚨 +4 KB 🚨
Dependency size 25.85 MB 25.96 MB 🚨 +107 KB 🚨
Bundle Size Analyzer browser node browser node

@storybook/vue3-vite

Before After Difference
Dependency count 106 106 0
Self size 34 KB 38 KB 🚨 +4 KB 🚨
Dependency size 42.66 MB 42.77 MB 🚨 +107 KB 🚨
Bundle Size Analyzer browser node browser node

@storybook/web-components-vite

Before After Difference
Dependency count 10 10 0
Self size 19 KB 20 KB 🚨 +261 B 🚨
Dependency size 1.25 MB 1.35 MB 🚨 +99 KB 🚨
Bundle Size Analyzer browser node browser node

@storybook/cli

Before After Difference
Dependency count 221 221 0
Self size 654 KB 878 KB 🚨 +224 KB 🚨
Dependency size 90.46 MB 102.21 MB 🚨 +11.75 MB 🚨
Bundle Size Analyzer node node

@storybook/codemod

Before After Difference
Dependency count 190 190 0
Self size 27 KB 35 KB 🚨 +7 KB 🚨
Dependency size 71.45 MB 78.41 MB 🚨 +6.96 MB 🚨
Bundle Size Analyzer node node

@storybook/core-webpack

Before After Difference
Dependency count 1 1 0
Self size 10 KB 12 KB 🚨 +2 KB 🚨
Dependency size 28 KB 28 KB 0 B
Bundle Size Analyzer node node

create-storybook

Before After Difference
Dependency count 1 1 0
Self size 15.62 MB 20.40 MB 🚨 +4.79 MB 🚨
Dependency size 98 KB 98 KB 0 B
Bundle Size Analyzer node node

@storybook/csf-plugin

Before After Difference
Dependency count 4 4 0
Self size 8 KB 9 KB 🚨 +1 KB 🚨
Dependency size 875 KB 875 KB 0 B
Bundle Size Analyzer node node

eslint-plugin-storybook

Before After Difference
Dependency count 35 35 0
Self size 108 KB 126 KB 🚨 +19 KB 🚨
Dependency size 3.38 MB 3.38 MB 0 B
Bundle Size Analyzer node node

@storybook/react-dom-shim

Before After Difference
Dependency count 0 0 0
Self size 9 KB 12 KB 🚨 +3 KB 🚨
Dependency size 785 B 785 B 0 B
Bundle Size Analyzer browser node browser node

@storybook/preset-create-react-app

Before After Difference
Dependency count 68 68 0
Self size 20 KB 26 KB 🚨 +5 KB 🚨
Dependency size 5.97 MB 5.97 MB 0 B
Bundle Size Analyzer node node

@storybook/preset-react-webpack

Before After Difference
Dependency count 170 170 0
Self size 20 KB 26 KB 🚨 +6 KB 🚨
Dependency size 30.40 MB 30.41 MB 🚨 +2 KB 🚨
Bundle Size Analyzer node node

@storybook/preset-server-webpack

Before After Difference
Dependency count 10 10 0
Self size 7 KB 8 KB 🚨 +2 KB 🚨
Dependency size 1.20 MB 1.20 MB 🚨 +2 KB 🚨
Bundle Size Analyzer node node

@storybook/react

Before After Difference
Dependency count 2 2 0
Self size 598 KB 872 KB 🚨 +274 KB 🚨
Dependency size 15 KB 18 KB 🚨 +3 KB 🚨
Bundle Size Analyzer browser node browser node

@storybook/server

Before After Difference
Dependency count 3 3 0
Self size 8 KB 9 KB 🚨 +1 KB 🚨
Dependency size 716 KB 716 KB 0 B
Bundle Size Analyzer browser node browser node

@storybook/svelte

Before After Difference
Dependency count 2 2 0
Self size 43 KB 48 KB 🚨 +5 KB 🚨
Dependency size 230 KB 230 KB 0 B
Bundle Size Analyzer browser node browser node

@storybook/vue3

Before After Difference
Dependency count 3 3 0
Self size 50 KB 61 KB 🚨 +11 KB 🚨
Dependency size 212 KB 212 KB 0 B
Bundle Size Analyzer browser node browser node

@JReinhold JReinhold marked this pull request as ready for review July 23, 2025 07:06
@JReinhold JReinhold requested review from Copilot and ndelangen July 23, 2025 07:06
Copy link
Contributor

@Copilot 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 removes minification from the Storybook build process to improve debugging capabilities and make build outputs more readable. The change simplifies the build configuration by removing production-specific minification settings and eliminates the need to pass the isProduction parameter throughout the build system.

  • Removes minification settings (minifyIdentifiers, minifySyntax, minifyWhitespace) from esbuild configuration
  • Adds unique identifiers to CJS compatibility imports to prevent naming collisions during bundle composition
  • Updates package.json files with new gitHead references

Reviewed Changes

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

File Description
scripts/build/utils/generate-bundle.ts Removes minification options and adds unique CJS import naming
scripts/build/build-package.ts Removes isProduction parameter from generateBundle call
Multiple package.json files Updates gitHead references to new commit hash

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

39 files reviewed, no comments

Edit Code Review Bot Settings | Greptile

@ndelangen ndelangen merged commit ac50575 into sb10/esm-only Jul 23, 2025
53 checks passed
@ndelangen ndelangen deleted the jeppe/unminify branch July 23, 2025 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci:normal maintenance User-facing maintenance tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants