Angular: Add moduleResolution: bundler to tsconfig#34085
Angular: Add moduleResolution: bundler to tsconfig#34085valentinpalkovic merged 2 commits intonextfrom
Conversation
📝 WalkthroughWalkthroughUpdated TypeScript configuration in the Angular Storybook template by adding Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
code/lib/create-storybook/templates/angular/application/template-csf/.storybook/tsconfig.json (1)
6-7: Please add regression coverage for this generated config.This fixes a template-level crash path, so a fixture/snapshot assertion that generated
.storybook/tsconfig.jsonincludes"moduleResolution": "bundler"would help keep it from regressing silently.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@code/lib/create-storybook/templates/angular/application/template-csf/.storybook/tsconfig.json` around lines 6 - 7, Add a regression test that generates the Angular CSF application template (template-csf) and asserts the generated .storybook/tsconfig.json contains the JSON property "moduleResolution": "bundler" (either via a snapshot or an explicit assertion on the parsed JSON). Locate the test that exercises template generation for the Angular application and extend it to read the generated .storybook/tsconfig.json, parse it, and assert moduleResolution === "bundler" so the template-level crash path is covered.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In
`@code/lib/create-storybook/templates/angular/application/template-csf/.storybook/tsconfig.json`:
- Around line 6-7: Add a regression test that generates the Angular CSF
application template (template-csf) and asserts the generated
.storybook/tsconfig.json contains the JSON property "moduleResolution":
"bundler" (either via a snapshot or an explicit assertion on the parsed JSON).
Locate the test that exercises template generation for the Angular application
and extend it to read the generated .storybook/tsconfig.json, parse it, and
assert moduleResolution === "bundler" so the template-level crash path is
covered.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 1b28970d-631a-4515-a3bc-8b9aa422fff2
📒 Files selected for processing (1)
code/lib/create-storybook/templates/angular/application/template-csf/.storybook/tsconfig.json
|
View your CI Pipeline Execution ↗ for commit e6a45fc
☁️ Nx Cloud last updated this comment at |
Closes #34070
What I did
Storybook crashes as soon as TypeScript errors occur in Storybook files. One of the biggest issues currently is that type declarations from Storybook packages require a specific user tsconfig (moduleResolution=bundler). A misconfigured tsconfig file leads to a crash. This PR adds
moduleResolution: bundlerto the created.storybook/tsconfig.jsonfile, so that types from Storybook packages are detected properly.Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
Caution
This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!
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 publish.yml --field pr=<PR_NUMBER>Summary by CodeRabbit