Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add config to specify plugin-transform-react-jsx throwIfNamespace #102

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

CorruptedHeart
Copy link

It appears that specifying throwIfNamespace in a .babelrc file no longer causes it to apply to the @babel/plugin-transform-react-jsx or @babel/plugin-transform-react-jsx-development. Even if specifying babelrc: true as a config option.

This is to allow stuff like unocss attributify mode which supports attributes like disabled:bg-grey on elements.

Currently the only documented use case is throwIfNamespace.

@rschristian
Copy link
Member

Couldn't you simply specify your own copy of the @babel/plugin-transform-react-jsx plugin with the necessary options?

@CorruptedHeart
Copy link
Author

@rschristian due to the order of the spreads here: https://github.com/preactjs/preset-vite/blob/main/src/index.ts#L193-L202, it causes warnings about duplicate plugins.

Also, we'd be relying on the users to also care about stuff like isProduction, etc.

@rschristian
Copy link
Member

In that case, perhaps we can detect if the user-provided plugins contains the jsx transform, and if so, replace the plugin config completely (rather than spread into it)?

Another config option is worst-case scenario, and doesn't seem fitting for a niche Babel option.

Also, we'd be relying on the users to also care about stuff like isProduction, etc.

Their config, their choice whether to care or not.

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.

None yet

2 participants