Skip to content

Build: No dts-mapper files during dev#33759

Merged
valentinpalkovic merged 3 commits into
nextfrom
norbert/experiment-dts
Feb 3, 2026
Merged

Build: No dts-mapper files during dev#33759
valentinpalkovic merged 3 commits into
nextfrom
norbert/experiment-dts

Conversation

@ndelangen
Copy link
Copy Markdown
Member

@ndelangen ndelangen commented Feb 3, 2026

What I did

We can use this functionality:
https://www.typescriptlang.org/tsconfig/#customConditions

To skip on generating the dts mapper files we had.
It might eliminate a race-condition we had at compile very occasionally, example:
https://app.circleci.com/pipelines/github/storybookjs/storybook/114019/workflows/4466ed1c-e3b6-4e91-990d-12a24fd4518d/jobs/1067742

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

  • Run a local compile locally (in normal link mode)
  • Check if type definitions are present (they should not)
  • Restart TypeScript language server, wait for it to load again
  • Check if an import such as this: import { Button, Link, SyntaxHighlighter } from 'storybook/internal/components'; retains it's type-safely, and allows you to jump to source/definitions (they should now be the same thing)

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
    • Enhanced package exports to include source code references, enabling better tooling integration and source map support across the framework and related packages.
    • Updated build configuration and streamlined type generation pipeline for improved build efficiency.

@ndelangen ndelangen self-assigned this Feb 3, 2026
@ndelangen ndelangen added build Internal-facing build tooling & test updates ci:normal labels Feb 3, 2026
@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Feb 3, 2026

View your CI Pipeline Execution ↗ for commit e8d4488

Command Status Duration Result
nx run-many -t compile,check,knip,test,pretty-d... ✅ Succeeded 14m 11s View ↗

☁️ Nx Cloud last updated this comment at 2026-02-03 10:34:58 UTC

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 3, 2026

📝 Walkthrough

Walkthrough

This pull request systematically adds "code" export fields to package.json files across the codebase, pointing to TypeScript source files. Accompanying build changes update export map generation and remove the type mapper utility that is no longer needed with the new export structure.

Changes

Cohort / File(s) Summary
Addon Packages
code/addons/a11y/package.json, code/addons/docs/package.json, code/addons/links/package.json, code/addons/onboarding/package.json, code/addons/pseudo-states/package.json, code/addons/themes/package.json, code/addons/vitest/package.json
Added "code" export fields pointing to TypeScript source files for each addon's main and secondary exports (e.g., "./preview", "./vitest-plugin").
Builder Packages
code/builders/builder-vite/package.json, code/builders/builder-webpack5/package.json
Added "code" export field pointing to "./src/index.ts" for main export entry.
Core Package
code/core/package.json
Added "code" export fields for 33+ export paths, including main entry, framework integrations, internal modules, and preview/manager APIs, each pointing to corresponding TypeScript source files.
Framework Packages
code/frameworks/angular/package.json, code/frameworks/ember/package.json, code/frameworks/html-vite/package.json, code/frameworks/nextjs-vite/package.json, code/frameworks/nextjs/package.json, code/frameworks/preact-vite/package.json, code/frameworks/react-native-web-vite/package.json, code/frameworks/react-vite/package.json, code/frameworks/react-webpack5/package.json, code/frameworks/server-webpack5/package.json, code/frameworks/svelte-vite/package.json, code/frameworks/sveltekit/package.json, code/frameworks/vue3-vite/package.json, code/frameworks/web-components-vite/package.json
Added "code" export fields for framework packages, pointing to root and optional secondary exports (e.g., "./node", "./preview", "./preset") in their respective src directories.
Library Packages
code/lib/codemod/package.json, code/lib/core-webpack/package.json, code/lib/csf-plugin/package.json, code/lib/eslint-plugin/package.json, code/lib/react-dom-shim/package.json
Added "code" export field for main export entry in each library package.
Preset Packages
code/presets/react-webpack/package.json, code/presets/server-webpack/package.json
Added "code" export field pointing to main source file for each preset.
Renderer Packages
code/renderers/html/package.json, code/renderers/preact/package.json, code/renderers/react/package.json, code/renderers/server/package.json, code/renderers/svelte/package.json, code/renderers/vue3/package.json, code/renderers/web-components/package.json
Added "code" export fields for renderer packages, including main exports and framework-specific exports (e.g., "./experimental-playwright", "./preview").
Build Configuration
code/tsconfig.json
Added "code" to customConditions compiler option to recognize code exports during TypeScript resolution.
Build Utilities
scripts/build/utils/generate-package-json.ts
Updated export map generation to include "code" field pointing to entry.entryPoint when dts is undefined.
Build Script Changes
scripts/build/build-package.ts
Removed import and invocation of generateTypesMapperFiles function.
Deleted Build Module
scripts/build/utils/generate-type-mappers.ts
Removed entire module containing generateTypesMapperContent and generateTypesMapperFiles functions that were used for type mapper generation.
TypeScript Source Fix
code/core/src/types/modules/api-stories.ts
Changed StatusByTypeId import from external source to local module import from './status'.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

✨ Finishing touches
  • 📝 Generate docstrings

Important

Action Needed: IP Allowlist Update

If your organization protects your Git platform with IP whitelisting, please add the new CodeRabbit IP address to your allowlist:

  • 136.113.208.247/32 (new)
  • 34.170.211.100/32
  • 35.222.179.152/32

Failure to add the new IP will result in interrupted reviews.


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

@valentinpalkovic valentinpalkovic merged commit aa06ce7 into next Feb 3, 2026
128 of 132 checks passed
@valentinpalkovic valentinpalkovic deleted the norbert/experiment-dts branch February 3, 2026 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Internal-facing build tooling & test updates ci:normal

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants