Angular: Bundle using TSup#31690
Conversation
Maybe we do not need to publish it anymore that way
|
View your CI Pipeline Execution ↗ for commit eef4990.
☁️ Nx Cloud last updated this comment at |
There was a problem hiding this comment.
Pull Request Overview
Bundle the Angular framework using TSup by replacing the previous webpack-based build setup and updating config files accordingly.
- Consolidate and update TypeScript configs (
tsconfig.json/tsconfig.spec.json), removing the oldtsconfig.build.json. - Refactor package exports and add TSup-specific
bundlerentries inpackage.json; move and rewritebuilders.jsonto the package root. - Update
preset.tsto resolve dist paths viagetAbsolutePath, and remove the postbuild compatibility script and webpack HMR references.
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| code/frameworks/angular/tsconfig.spec.json | Removed webpack-env from types |
| code/frameworks/angular/tsconfig.json | Changed extends, added compiler options, adjusted include |
| code/frameworks/angular/tsconfig.build.json | Deleted legacy build config |
| code/frameworks/angular/src/preset.ts | Switched previewAnnotations to use absolute dist paths |
| code/frameworks/angular/src/client/index.ts | Dropped webpack-env ref and HMR stop code |
| code/frameworks/angular/scripts/postbuild.js | Removed postbuild compatibility hack |
| code/frameworks/angular/package.json | Added new exports, typesVersions, bundler entries, scripts |
| code/frameworks/angular/builders.json | Added root-level TSup-compatible builders.json |
Comments suppressed due to low confidence (6)
code/frameworks/angular/src/preset.ts:29
- [nitpick] This
docsConfigshadows the earlierdocsConfigfrompresets.apply; consider renaming the path constant (e.g.docsPath) to avoid shadowing and improve clarity.
const docsConfig = join(getAbsolutePath('@storybook/angular'), 'dist/client/docs/config.mjs');
code/frameworks/angular/scripts/postbuild.js:1
- The postbuild script that added
@ts-ignorefor Angular <17.2 types was removed; without it, builds may fail on older Angular versions. Please ensure compatibility is handled elsewhere.
const fs = require('fs');
code/frameworks/angular/package.json:156
- [nitpick] You’ve added
previewEntriesandnodeEntriesfor TSup bundling but no tests; consider adding unit or integration tests to validate the bundle output and entry sets.
"bundler": {
code/frameworks/angular/tsconfig.spec.json:4
- Removing
webpack-envfrom test types may cause missing global typings (likemodule.hot) during tests; please verify test environments or re-add the necessary types.
"types": ["node"],
code/frameworks/angular/tsconfig.json:10
- JSON imports are no longer included (
src/**/*.jsonwas removed); if you rely onimporting JSON, add back"src/**/*.json"or enableresolveJsonModule.
"include": ["src/**/*", "./src/typings.d.ts"]
code/frameworks/angular/src/preset.ts:23
- Using
require.resolveon a relative path may fail once packaged; for consistency with the config path above, considerjoin(getAbsolutePath('@storybook/angular'), 'dist/client/preview-prod.mjs').
annotations.unshift(require.resolve('./dist/client/preview-prod.mjs'));
Package BenchmarksCommit: The following packages have significant changes to their size or dependencies:
|
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 209 | 199 | 🎉 -10 🎉 |
| Self size | 607 KB | 189 KB | 🎉 -418 KB 🎉 |
| Dependency size | 29.79 MB | 29.70 MB | 🎉 -94 KB 🎉 |
| Bundle Size Analyzer | Link | Link |
…tePath for better compatibility
…dependency injection and prevent runtime errors
…ency injection and prevent runtime errors
…mply with ESLint rules.
There was a problem hiding this comment.
108 files reviewed, 4 comments
Edit PR Review Bot Settings | Greptile
…endency injection and compliance with ESLint rules. Consolidate multiple imports from '@angular/core' and update paths in preset.ts for clarity.
| "check": "jiti ../../../scripts/prepare/check.ts", | ||
| "prep": "jiti ../../../scripts/prepare/addon-bundle.ts" |
There was a problem hiding this comment.
for future reference, this is the main change
What I did
Changes
Benefits
Technical Details
@types/webpack-envdependencymoduleResolution: "bundler"builders.jsonChecklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
I manually tested the angular sandbox, explicitly verifying that HMR does still work. (it does)
Documentation
MIGRATION.MD
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal,ci:mergedorci:dailyGH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli-storybook/src/sandbox-templates.tsMake 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/coreteam 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
Comprehensive modernization of Angular framework build configuration in Storybook, replacing webpack with TSup bundler and optimizing TypeScript usage.
@types/webpack-envdependency and related webpack configurations across 60+ files, switching to modern TSup bundlingimport typesyntax throughout codebase for better tree-shaking and reduced bundle sizesrc/builders/to root-level schema files and updating Angular CLI integrationmoduleResolution: "bundler"and removes unnecessary post-build scripts