Skip to content

fix: keep injecting styles when defaultLocale is set - #278

Open
pleqtron wants to merge 1 commit into
element-plus:mainfrom
pleqtron:fix-default-locale-style-injection
Open

pleqtron wants to merge 1 commit into
element-plus:mainfrom
pleqtron:fix-default-locale-style-injection

Conversation

@pleqtron

Copy link
Copy Markdown

Fixes #277

Since 36aa3ee the transform handler returns after the locale transform whenever defaultLocale is set. transformDefaultLocale is a no-op for every id except the use-locale module, but the early return still skips transformStyle, so no component style import is injected at all.

This PR only takes the locale branch for the locale module itself and falls through to the style transform for everything else, matching the 0.10.0 behaviour. Adds a test that builds the basic.ts fixture with useSource: true, defaultLocale: 'de' and asserts the button and col style imports are present; it fails on main and passes with the fix.

Since 36aa3ee (perf: prefer to use native magic-string) the transform
handler returns after the locale transform whenever `defaultLocale` is
set. `transformDefaultLocale` only acts on the `use-locale` module and
is a no-op for every other id, but the early return still skips
`transformStyle`, so no component style import is injected at all.

Only take the locale branch for the locale module itself and fall
through to the style transform for everything else, as 0.10.0 did.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0.11.x: setting defaultLocale disables component style injection

1 participant