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 .js extension to react runtime for JSX transform #12116

Merged
merged 1 commit into from Sep 30, 2020

Conversation

lunaruan
Copy link
Contributor

@lunaruan lunaruan commented Sep 28, 2020

Q                       A
Fixed Issues? Issue reported here.
Patch: Bug Fix? Yes
Major: Breaking Change? No
Minor: New Feature? No
Tests Added + Pass? Yes
Documentation PR Link No
Any Dependency Changes? No
License MIT

Previously when we transformed JSX, we auto imported from ${source}/jsx-runtime and ${source}/jsx-dev-runtime. However, these functions don't have extensions, which will not work for vanilla JS imports (and might not work for in the future for Node). This PR adds the .js extension to the auto import source so now we will auto import from ${source}/jsx-runtime.js and ${source}/jsx-dev-runtime.js.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Sep 28, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit d6b0822:

Sandbox Source
babel-repl-custom-plugin Configuration
babel-plugin-multi-config Configuration

@babel-bot
Copy link
Collaborator

babel-bot commented Sep 28, 2020

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/28940/

Copy link
Contributor

@JLHwung JLHwung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since Automatic JSX transform does not work with AMD be design (facebook/react#18299 (comment)). Adding .js will not cause issues like #10832.

Copy link
Member

@nicolo-ribaudo nicolo-ribaudo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@marvinhagemeister
Copy link
Contributor

I'm afraid that despite good intentions, this is a breaking change and broke the build pipeline for a few Preact users preactjs/preact#2801 :S Made #12210 to continue the discussion

nicolo-ribaudo added a commit that referenced this pull request Oct 19, 2020
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Jan 18, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: react outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Bug Fix 🐛 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants