Skip to content

Support jsx-runtime API#39

Open
LewsTherinTelescope wants to merge 2 commits intoTheKnarf:masterfrom
LewsTherinTelescope:jsx-runtime
Open

Support jsx-runtime API#39
LewsTherinTelescope wants to merge 2 commits intoTheKnarf:masterfrom
LewsTherinTelescope:jsx-runtime

Conversation

@LewsTherinTelescope
Copy link

By exporting these functions (which just delegate to the existing implementation), users who set Babel (or TypeScript or any other tool with support) to the automatic mode and configure the module don't need to manually add the imports, as the compiler will be able to automatically insert them.

I've had to change the project's .babelrc to use automatic in order to run the new tests, because the @jsxRuntime pragma can be used to revert to the older mode for a single file but can't be used to update to the newer one, as it's implemented in the transform-react-jsx plugin that only gets used in auto mode.

I've also added the transform-modules-commonjs plugin in order to transpile auto.test.js, as for whatever reason automatic mode always inserts ESM imports even when it's a CommonJS file, but Jest's support for ESM is buggy so running the file as-is doesn't work.

Also removed previously-added TypeScript instructions, as it turns out
that using it through TSC doesn't work without type declarations.
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.

1 participant