Skip to content

Angular: Add moduleResolution: bundler to tsconfig#34085

Merged
valentinpalkovic merged 2 commits intonextfrom
valentin/angular-no-check
Mar 10, 2026
Merged

Angular: Add moduleResolution: bundler to tsconfig#34085
valentinpalkovic merged 2 commits intonextfrom
valentin/angular-no-check

Conversation

@valentinpalkovic
Copy link
Copy Markdown
Contributor

@valentinpalkovic valentinpalkovic commented Mar 9, 2026

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: bundler to the created .storybook/tsconfig.json file, 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:

  • stories
  • unit tests
  • integration tests
  • end-to-end 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

  • 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 publish.yml --field pr=<PR_NUMBER>

Summary by CodeRabbit

  • Chores
    • Updated TypeScript module resolution configuration for Storybook Angular templates to enhance compatibility and consistency with modern tooling standards.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 9, 2026

Fails
🚫 The "#### Manual testing" section must be filled in. Please describe how to test the changes you've made, step by step, so that reviewers can confirm your PR works as intended.

Generated by 🚫 dangerJS against e6a45fc

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 9, 2026

📝 Walkthrough

Walkthrough

Updated TypeScript configuration in the Angular Storybook template by adding moduleResolution: "bundler" to compiler options and formatting the JSON with a trailing comma after resolveJsonModule.

Changes

Cohort / File(s) Summary
TypeScript Configuration
code/lib/create-storybook/templates/angular/application/template-csf/.storybook/tsconfig.json
Added moduleResolution: "bundler" compiler option and adjusted JSON formatting with trailing comma.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 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.json includes "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

📥 Commits

Reviewing files that changed from the base of the PR and between 8dff441 and e6a45fc.

📒 Files selected for processing (1)
  • code/lib/create-storybook/templates/angular/application/template-csf/.storybook/tsconfig.json

@nx-cloud
Copy link
Copy Markdown

nx-cloud bot commented Mar 10, 2026

View your CI Pipeline Execution ↗ for commit e6a45fc

Command Status Duration Result
nx run-many -t compile -c production --parallel=1 ✅ Succeeded 4m 46s View ↗

☁️ Nx Cloud last updated this comment at 2026-03-10 07:37:48 UTC

@valentinpalkovic valentinpalkovic merged commit 09ce99c into next Mar 10, 2026
127 of 138 checks passed
@valentinpalkovic valentinpalkovic deleted the valentin/angular-no-check branch March 10, 2026 08:06
@github-actions github-actions bot mentioned this pull request Mar 10, 2026
11 tasks
@valentinpalkovic valentinpalkovic added needs qa Indicates that this needs manual QA during the upcoming minor/major release and removed needs qa Indicates that this needs manual QA during the upcoming minor/major release labels Mar 10, 2026
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.

[Bug]: Unable to setup storybook (angular 20) Error: Unknown argument: silent

2 participants