swr: Can't import the named export 'createContext' from non EcmaScript module (only default export is available)
Bug report
Description / Observed Behavior
In the project I created via create-react-app, when I run the build script, I get the following error
Failed to compile.
./node_modules/swr/dist/_internal/config-context-client-x_C9_NWC.mjs
Can't import the named export 'createContext' from non EcmaScript module (only default export is available)
What kind of issues did you encounter with SWR? build error
Expected Behavior
build success How did you expect SWR to behave here?
Repro Steps / Code Example
Or share your code snippet or a CodeSandbox link is also appreciated!
Additional Context
SWR version.
swr@2.3.0
Add any other context about the problem here.
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 3
- Comments: 17 (1 by maintainers)
have spent almost a full day tracking here. the project I maintain indirectly depends on swr via
ant-design/pro-layout, recently got this error when pack, suspecting it had something to do with ESM, CommonJS compatibility. bypassed this by specifying swr to v2.2.5Return to version 2.2.5
+1 same error
same error on version 2.2.5 and 2.3.0