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

docs(jsx): add some more detail to #with-swc section in jsx-pragma docs #2094

Merged
merged 2 commits into from
Jan 29, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions packages/docs/src/pages/guides/jsx-pragma.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,11 @@ typecheck), or for instance to run tests with `ts-jest`
NOTE: this requires
[TypeScript >= 4.1](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-1.html#react-17-jsx-factories)

### Using next.js
### Using Next.js

#### With Babel

```js
// babel.config.js
```js filename=babel.config.js
module.exports = {
presets: [
[
Expand All @@ -173,12 +172,17 @@ You can read more about

#### With SWC

Next.js is [gradually migrating to SWC](https://nextjs.org/docs/advanced-features/compiler#why-swc),
and recommends using it for all new projects.

In `jsconfig.json` or `tsconfig.json` (since Next.js 12.0.4):

```json
{
"compilerOptions": {
"jsxImportSource": "theme-ui"
"jsx": "preserve",
"jsxImportSource": "theme-ui" // or "@theme-ui/core"
// ... the rest of your compilerOptions redacted for brevity
}
}
```