enable @swc-jotai/react-refresh
in [email protected] will cause pages using 'use client' error #21
Open
Description
reproduce step
- init a new next.js repo
- install
jotai
and@swc-jotai/react-refresh
- enable
@swc-jotai/react-refresh
innext.config.js
- add a jotai atom in a page with 'use client'
- get the error
reproduce repo
log
./app/page.tsx
ReactServerComponentsError:
The "use client" directive must be placed before other expressions. Move it to the top of the file to resolve this issue.
╭─[/Users/seiry/gitwork/jotai-refresh-use-client/app/page.tsx:1:1]
1 │ 'use client'
· ────────────
2 │ import { atom, useAtom } from 'jotai'
3 │
4 │ const valueAtom = atom('hello')
╰────
Import path:
./app/page.tsx
It seems the plugin added some line at the file header.( sorry I'm not a rust master lol