-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
RSC Example doesn't work #2976
Comments
You can run this example with |
I'm probably doing something run, but when I run it with |
You might still use the
Yeah, this example points to the latest version of SWR, so this won't work. |
CONTRIBUTING.md will also help you. |
Thanks for explaining! I've updated the Packages: +24
++++++++++++++++++++++++
Progress: resolved 32, reused 19, downloaded 5, added 24, done
dependencies:
+ next 14.2.3
+ react 18.3.1
+ react-dom 18.3.1
+ swr 2.2.6-beta.4
Done in 3.1s
➜ suspense pnpm build
> [email protected] build /Users/Dev/suspense
> next build
▲ Next.js 14.2.3
Creating an optimized production build ...
✓ Compiled successfully
✓ Linting and checking validity of types
Collecting page data ..file:///Users/Dev/suspense/node_modules/.pnpm/[email protected][email protected]/node_modules/swr/dist/_internal/index.mjs:1
import { i as isWindowDefined, a as isFunction, m as mergeObjects, S as SWRConfigContext, d as defaultConfig, s as serialize, b as SWRGlobalState, c as cache, e as isUndefined, f as mergeConfigs } from './config-context-client-Ds68J9M9.js';
^
SyntaxError: Named export 'S' not found. The requested module './config-context-client-Ds68J9M9.js' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from './config-context-client-Ds68J9M9.js';
const { i: isWindowDefined, a: isFunction, m: mergeObjects, S: SWRConfigContext, d: defaultConfig, s: serialize, b: SWRGlobalState, c: cache, e: isUndefined, f: mergeConfigs } = pkg;
at ModuleJob._instantiate (node:internal/modules/esm/module_job:132:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:214:5)
at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
at async importModuleDynamicallyWrapper (node:internal/vm/module:431:15)
> Build error occurred
Error: Failed to collect page data for /
at /Users/Dev/suspense/node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/next/dist/build/utils.js:1268:15 {
type: 'Error'
}
Collecting page data . ELIFECYCLE Command failed with exit code 1. I am able to run the rsc example now though |
Bug report
The RSC example from the examples folder doesn't work.
Description / Observed Behavior
The RSC example as is, throws an error when running it.
When I
await
the request (const serverData = fetcher('http://localhost:3000/api/data')
inpage.jsx
it does works.Expected Behavior
I expect being able run the example without having to await the promise in the page component.
Repro Steps / Code Example
I cloned the RSC example
run
yarn install
run
yarn run dev
navigate to
localhost:3000/rsc
I see
TypeError: data.map is not a function
.Additional Context
SWR version: 2.2.5
The text was updated successfully, but these errors were encountered: