You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The migration update-emotion-setup.ts and use-react-jsx-in-tsconfig.ts include much of the setup, but I still had a lot of problems beyond this since jsxImportSource was not added to tsconfig.
I was previously using the Pragme format as shown below.
After I finally got migrated and npm install worked, I noticed some build errors:
ERRORinlibs/ui/src/lib/widgets/ItemSelectionSummary.tsx:37:7
TS2322: Type '{ children: Element; css: SerializedStyles;}' is not assignable to type 'DetailedHTMLProps<HTMLAttributes<HTMLDivElement>,HTMLDivElement>'.Property 'css' does not exist on type 'DetailedHTMLProps<HTMLAttributes<HTMLDivElement>,HTMLDivElement>'.
35|return(36|<div> 37 | css={css` | ^^^ 38 | min-height: 20px; 39 | `}
40 | >
To resolve I had to do the following:
Remove /** @jsx jsx */ from every file that used it
Remove import { jsx } from '@emotion/react' from every file that used it 3. Update all the .babelrc files to use this format "presets": [["@nrwl/react/babel", { "preset-react": { "runtime": "automatic", "importSource": "@emotion/react" } }]],
Update all the .babelrc files to use this format "presets": [["@nrwl/react/babel", { "runtime": "automatic", "importSource": "@emotion/react" }]],
"presets": [["@nrwl/react/babel", { "runtime": "automatic", "importSource": "@emotion/react" }]],
Add jsxImportSource": "@emotion/react", to every tsconfig file that had "jsx": "react-jsx", added
To me, this seems like something that should be part of the migration process, or at least called out as special steps if someone is using the css prop from emotion.
The text was updated successfully, but these errors were encountered:
The migration
update-emotion-setup.ts
anduse-react-jsx-in-tsconfig.ts
include much of the setup, but I still had a lot of problems beyond this sincejsxImportSource
was not added to tsconfig.I was previously using the Pragme format as shown below.
After I finally got migrated and
npm install
worked, I noticed some build errors:To resolve I had to do the following:
/** @jsx jsx */
from every file that used itimport { jsx } from '@emotion/react'
from every file that used it3. Update all the.babelrc
files to use this format"presets": [["@nrwl/react/babel", { "preset-react": { "runtime": "automatic", "importSource": "@emotion/react" } }]],
.babelrc
files to use this format"presets": [["@nrwl/react/babel", { "runtime": "automatic", "importSource": "@emotion/react" }]],
"presets": [["@nrwl/react/babel", { "runtime": "automatic", "importSource": "@emotion/react" }]],
jsxImportSource": "@emotion/react",
to every tsconfig file that had"jsx": "react-jsx",
addedIt was a pretty painful process and I finally found the last bit of help I needed here: emotion-js/emotion#2111 (comment)
To me, this seems like something that should be part of the migration process, or at least called out as special steps if someone is using the
css
prop from emotion.The text was updated successfully, but these errors were encountered: