-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Setting up a basic React/Emotion project results in Exception: pragma and pragmaFrag cannot be set #2442
Comments
You need to add the JSX runtime directive to force the classic runtime or use this approach Try this: /** @jsxRuntime classic */
/** @jsx jsx */
import { css, jsx } from '@emotion/react' |
Create React App 4 then
|
Is using |
If you are using Emotion 11 then yes - IIRC Unfortunately, those PRs/issues got stale and there is nothing happening in those directions. |
Is there any way to enable this line globally so you don't have to add it to each file individually? Something like this solution for next.js adding it to the next-env.d.ts file? |
@toffalori it depends on the tools that you are using. If your tools allow customization of configs etc it should be possible to configure them to do this automatically. |
Closing in favor of #2662 since this issue is about configuring Emotion in Create React App. In the latest CRA, you just add We do need to improve our documentation in this area, hence the existence of #2662. |
Current behavior:
First time attempting to use Emotion with React, first created an app using Create React App, then added
@emotion/react
as a dependency. Finally, followed docs to include:Result is an exception at compile time:
Sample repo can be found here: https://github.com/feefhq/react-emotion-baseline
To reproduce:
src/App.js
(as per introduction docs:Expected behavior:
It should compile.
Environment information:
react
version:^17.0.2
@emotion/react
version:^11.4.0
The text was updated successfully, but these errors were encountered: