Skip to content

fix: resolve antd to one copy in tests and Storybook - #340

Merged
mic-web merged 1 commit into
masterfrom
unify-antd-imports
Oct 30, 2026
Merged

mic-web merged 1 commit into
masterfrom
unify-antd-imports

Conversation

@spawnia

@spawnia spawnia commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Provider sets the mll-ant prefix and the German locale on the ConfigProvider it imports from antd.
In jest, bare antd resolved to antd/lib, so components importing antd/es/* read another context and rendered ant- classes and the default locale.

The published bundle was not affected: rollup resolves antd to antd/es, and its source map lists one config-provider/context.js.
After this change the bundle no longer contains antd/lib locale modules, and esm/index.css is byte-identical.

babel-plugin-import goes, because it only ever ran where it caused the split

@rollup/plugin-babel handles only .js files by default, so the plugin never touched the TypeScript sources in the build; rollup tree-shakes bare antd imports itself.
Storybook compiles the sources with babel, where the plugin rewrote bare antd imports to antd/lib, its default libraryDirectory.
If the build's babel extensions were ever widened, the plugin would have introduced the same split into the bundle.

For agents 🤖: in review by mic-web, merge after approval
  • New test src/Provider/index.test.tsx fails on master: FilledButton and DatePicker render ant- classes and no Datum auswählen placeholder inside Provider.
  • Checked locally: typecheck, lint, all 202 jest tests, yarn build, yarn storybook:build.
  • Not checked: Storybook rendering in a browser.

🤖 Generated with Claude Code

Provider sets the mll-ant prefix and the German locale on the ConfigProvider
it imports from antd. jest resolved bare antd to antd/lib, while components
importing antd/es/* read another context, so they rendered ant- classes and
the default locale. Storybook compiles the sources with babel, where
babel-plugin-import rewrote bare antd imports to antd/lib, the same split.
The rollup bundle was fine, it resolves antd to antd/es.

Imports now use antd/es throughout, jest maps bare antd to antd/es, and the
plugin, which never ran on the TypeScript sources in the build, is gone.

🤖 Generated with Claude Code
@spawnia
spawnia force-pushed the unify-antd-imports branch from 96d7fb5 to 12ea5fd Compare October 30, 2026 08:11
@spawnia
spawnia marked this pull request as ready for review October 30, 2026 08:30
@spawnia
spawnia requested a review from mic-web October 30, 2026 08:30
@mic-web
mic-web merged commit a4c961b into master Oct 30, 2026
10 checks passed
@mic-web
mic-web deleted the unify-antd-imports branch October 30, 2026 08:52
github-actions Bot pushed a commit that referenced this pull request Oct 30, 2026
## [21.0.2](v21.0.1...v21.0.2) (2026-10-30)

### Bug Fixes

* resolve antd to one copy in tests and Storybook ([#340](#340)) ([a4c961b](a4c961b))
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 21.0.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants