Unverified Commit a090b5cd authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Ensure async_hooks are not resolved for client (#41778)

Fixes: [slack
thread](https://vercel.slack.com/archives/C02UJN0A1UL/p1666689839050269)
parent e7f97c33
......@@ -243,7 +243,7 @@ const nextAppLoader: webpack.LoaderDefinitionFunction<{
export const LayoutRouter = require('next/dist/client/components/layout-router.js').default
export const RenderFromTemplateContext = require('next/dist/client/components/render-from-template-context.js').default
export const staticGenerationAsyncStorage = require('next/dist/client/components/static-generation-async-storage.js').staticGenerationAsyncStorage
export const staticGenerationAsyncStorage = require('next/dist/client/components/static-generation-async-storage').staticGenerationAsyncStorage
export const requestAsyncStorage = require('next/dist/client/components/request-async-storage.js').requestAsyncStorage
export const serverHooks = require('next/dist/client/components/hooks-server-context.js')
......
import type { AsyncLocalStorage } from 'async_hooks'
export interface StaticGenerationStore {
inUse?: boolean
pathname?: string
revalidate?: number
fetchRevalidate?: number
isStaticGeneration?: boolean
}
export let staticGenerationAsyncStorage:
| AsyncLocalStorage<StaticGenerationStore>
| StaticGenerationStore = {}
......@@ -2109,7 +2109,11 @@ export async function compile(task, opts) {
],
opts
)
await task.serial(['ncc_react_refresh_utils', 'ncc_next__react_dev_overlay'])
await task.serial([
'ncc_react_refresh_utils',
'ncc_next__react_dev_overlay',
'copy_package_json',
])
}
export async function bin(task, opts) {
......@@ -2196,6 +2200,29 @@ export async function nextbuildjest(task, opts) {
notify('Compiled build/jest files')
}
export async function copy_package_json(task, opts) {
await fs.copy(
join(
__dirname,
'client/components/static-generation-async-storage/package.json'
),
join(
__dirname,
'dist/client/components/static-generation-async-storage/package.json'
)
)
await fs.copy(
join(
__dirname,
'client/components/static-generation-async-storage/package.json'
),
join(
__dirname,
'dist/esm/client/components/static-generation-async-storage/package.json'
)
)
}
export async function client(task, opts) {
await task
.source(opts.src || 'client/**/*.+(js|ts|tsx)')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment