Next.js Discord

Discord Forum

next/flags: Code generation for chunk item errored

Unanswered
Jack @ DJL posted this in #help-forum
Open in Discord
Avatar
Im am litteraly following the tutorial


console:
jackr@Jacks-PC MINGW64 /d/dev/Athenetz-SV (v0.0.2-dev) $ yarn dev ▲ Next.js 15.0.2 (Turbopack) - Local: http://localhost:3000 - Environments: .env.local ✓ Starting... ✓ Ready in 3.1s ○ Compiling / ... ✓ Compiled / in 8.4s ⨯ ./node_modules/@vercel/flags/dist/next/index.js Code generation for chunk item errored An error occurred while generating the chunk item [project]/node_modules/@vercel/flags/dist/next/index.js [app-client] (ecmascript) Caused by: - the chunking context (unknown) does not support external modules (request: node:async_hooks) Debug info: - An error occurred while generating the chunk item [project]/node_modules/@vercel/flags/dist/next/index.js [app-client] (ecmascript) - Execution of *EcmascriptChunkItemContent::module_factory failed - Execution of *EcmascriptChunkItemContent::new failed - Execution of EcmascriptModuleContent::new failed - Execution of <EsmAssetReference as CodeGenerateable>::code_generation failed - the chunking context (unknown) does not support external modules (request: node:async_hooks) ○ Compiling /_error ... ✓ Compiled /_error in 1814ms GET / 500 in 11288ms

flags.ts:
import { unstable_flag as flag } from '@vercel/flags/next'; export const gk_Main = flag({ key: 'GateKeeper_Main', decide: () => false, });

page.tsx:
in next message (char limit)

2 Replies

Avatar
page.tsx:
"use client"; import UnderConstruction from "§comp/Homepage/UnderConstruction"; import LoggedOut from "§comp/Homepage/LoggedOut"; import LoggedIn from "§comp/Homepage/LoggedIn"; import { gk_Main } from "§api/flags"; import { fbauth } from "§api/firebase/firebase"; import { useAuthState } from "react-firebase-hooks/auth"; export default async function Decide() { const gkMain = await gk_Main(); async function userexists(): Promise<boolean> { const [user, loading, error] = useAuthState(fbauth); if (user) { return true; } else { return false; } } if (!gkMain) { return <UnderConstruction />; } else { if (await userexists()) { return <LoggedIn />; } else { return <LoggedOut />; } } }
Avatar
I was just comitting to gh for a link:
https://github.com/JackatDJL/Athenetz-SV/commit/23b8fd37ebd63074a2a089fdc21198189d1b5541

but i noticed vercel trying to build this and outputting its own error:

Creating an optimized production build ... Failed to compile. node:async_hooks Module build failed: UnhandledSchemeError: Reading from "node:async_hooks" is not handled by plugins (Unhandled scheme). Webpack supports "data:" and "file:" URIs by default. You may need an additional plugin to handle "node:" URIs. at /vercel/path0/node_modules/next/dist/compiled/webpack/bundle5.js:28:401783 at Hook.eval [as callAsync] (eval at create (/vercel/path0/node_modules/next/dist/compiled/webpack/bundle5.js:13:28858), <anonymous>:6:1) at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/vercel/path0/node_modules/next/dist/compiled/webpack/bundle5.js:13:26012) at Object.processResource (/vercel/path0/node_modules/next/dist/compiled/webpack/bundle5.js:28:401708) at processResource (/vercel/path0/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5308) at iteratePitchingLoaders (/vercel/path0/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4667) at runLoaders (/vercel/path0/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:8590) at NormalModule._doBuild (/vercel/path0/node_modules/next/dist/compiled/webpack/bundle5.js:28:401570) at NormalModule.build (/vercel/path0/node_modules/next/dist/compiled/webpack/bundle5.js:28:403598) at /vercel/path0/node_modules/next/dist/compiled/webpack/bundle5.js:28:82055 Import trace for requested module: node:async_hooks ./node_modules/@vercel/flags/dist/next/index.js ./src/ux/api/flags.ts ./src/app/page.tsx > Build failed because of webpack errors Error: Command "yarn run build" exited with 1