-
Notifications
You must be signed in to change notification settings - Fork 195
Description
React released a new babel JSX transform in 2020 so you don't have to import React in every component but pwa-kit is not using it.
Describe the solution you'd like
Use the new transform in: https://github.com/SalesforceCommerceCloud/pwa-kit/blob/develop/packages/pwa-kit-dev/src/configs/babel/babel-config.js#L20 (and line 48 for tests)
You'd change:
require('@babel/preset-react')
to
[
require('@babel/preset-react'),
{ "runtime": "automatic" }
]
PR would probably be larger if it goes through and removes the now unnecessary imports of React from the template app.
Note: There is a codemod in the blog post linked below that can help with this
Describe alternatives you've considered
Adjusting my own babel.config.js
file to override the default one
Additional context
Blog announcing the release: https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html