-
Notifications
You must be signed in to change notification settings - Fork 27.5k
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
Pages using getStaticProps
is broken in next.js 14
#57582
Comments
Same here with react-stately ⨯ file:///.../.next/standalone/node_modules/.pnpm/@[email protected][email protected]/node_modules/@react-stately/utils/dist/import.mjs:1
import {useState as $6imuh$useState, useRef as $6imuh$useRef, useCallback as $6imuh$useCallback} from "react";
^^^^^^^^^^^
SyntaxError: Named export 'useCallback' not found. The requested module 'react' 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 'react';
const {useState: $6imuh$useState, useRef: $6imuh$useRef, useCallback: $6imuh$useCallback} = pkg;
|
Same with
|
Same for
|
seeing the same for get server props (under page folder) for Interesting enough that the issue is not happening when running dev, but build will crash |
My issue comes from using an empty array in getStaticPaths, used to work pre Next 14 but now I get 500 errors when building. Works fine on Dev also
This worked perfectly fine before Next 14. |
Getting this error as well for swr but only on Vercel works fine locally, after upgrading to 14.0.0
|
Thanks for reporting this and including a reproduction, we'll take a look here 🙏 |
I'm not sure if it's related but upgrading to 14 doesn't seem to work on Vercel but fine locally.
Another
My _app.tsx looks like: <QueryClientProvider>
<Hydrate>
<AuthProvider>
<ChakraProvider>
<DefaultSeo />
<Component {...pageProps} />
</ChakraProvider>
</AuthProvider>
</Hydrate>
<ReactQueryDevtools />
</QueryClientProvider> |
+1 @7alip, it works locally |
BTW having such issues only happening on Vercel is pretty annoying. When we do such updates, we run the app in production mode to ensure that everything is fine but it's obviously not enough. Fortunately, we have a staging environment that prevented us from deploying this to production. It would be great to catch this kind of issues locally as well. Maybe a way to emulate the Vercel env. |
Happening to me too, only on Vercel. In this case it's trpc/react-query
|
Been tracking this back to which version / PR and a minimal reproduction. Minimal reproductionimport useSWR from 'swr'
console.log(useSWR)
export default function Home() {
return <h1>Hello</h1>
}
export async function getStaticProps() {
return {
props: {
foo: "bar",
},
};
} VersionManually went back canary versions to find which version introduced it with this reproduction: https://github.com/vercel/next.js/releases/tag/v13.5.6-canary.2 Which would indicate this is the PR that broke this case: #56924 We'll investigate further, Jimmy will be online in a few hours 👍 |
This removes the ignores for dev react bundles which was added as an optimization but causes issues when react is imported from an ESM module since all requires are being analyzed for named exports. Fixes #57582
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Link to the code that reproduces this issue
https://github.com/peakercope/material-ui-nextjs-pages-router-ts-example
To Reproduce
yarn install
yarn build
node .next/standalone/server.js
http://localhost:3000
in any browserCurrent vs. Expected behavior
Current behavior:
500 Internal Server Error
in browserConsole log:
Expected behavior:
App opens without error
Verify canary release
Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 23.1.0: Mon Oct 9 21:27:24 PDT 2023; root:xnu-10002.41.9~6/RELEASE_ARM64_T6000 Binaries: Node: 18.18.2 npm: 9.8.1 Yarn: 4.0.0 pnpm: 7.25.0 Relevant Packages: next: 14.0.0 eslint-config-next: 14.0.0 react: 18.2.0 react-dom: 18.2.0 typescript: 5.2.2 Next.js Config: output: standalone
Which area(s) are affected? (Select all that apply)
Not sure
Additional context
Pages
http://localhost:3000
andhttp://localhost:3000/about
responses with error.While page
http://localhost:3000/without-static-props
which doesn't havegetStaticProps
function opens successfully.NEXT-1700
The text was updated successfully, but these errors were encountered: