Skip to content
This repository has been archived by the owner on Dec 6, 2023. It is now read-only.

The templates should use the JSX runtime transform for React #296

Closed
lemonmade opened this issue Apr 25, 2022 · 2 comments
Closed

The templates should use the JSX runtime transform for React #296

lemonmade opened this issue Apr 25, 2022 · 2 comments

Comments

@lemonmade
Copy link
Member

Currently, the template imports the default export from React: https://github.com/Shopify/shopify-cli-extensions/blob/main/create/templates/shared/checkout_ui_extension/react.js#L1

This is an older pattern that prevents us from producing more optimized builds in the future (more detail from React’s release notes: https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html). It’s also more annoying for developers, because they need to manually include the React import in every file that uses JSX.

The previous version of the extension CLI did not require this import, and used the jsx-runtime way of creating React elements: https://github.com/Shopify/ui-extensions/blob/main/packages/checkout-ui-extensions-run/src/webpack-config.ts#L207-L213 / https://github.com/Shopify/checkout-ui-extensions-template/blob/main/scripts/generate/templates/checkout/src/index.tsx

@vividviolet
Copy link
Member

Is this a duplicate of #127?

@lemonmade
Copy link
Member Author

It is, thank you for pointing that out!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants