MCPcopy
hub / github.com/vercel/next.js / appBootstrap

Function appBootstrap

packages/next/src/client/app-bootstrap.ts:58–81  ·  view source on GitHub ↗
(hydrate: (assetPrefix: string) => void)

Source from the content-addressed store, hash-verified

56}
57
58export function appBootstrap(hydrate: (assetPrefix: string) => void) {
59 const assetPrefix = getAssetPrefix()
60
61 loadScriptsInSequence((self as any).__next_s, () => {
62 // If the static shell is being debugged, skip hydration if the
63 // `__nextppronly` query is present. This is only enabled when the
64 // environment variable `__NEXT_EXPERIMENTAL_STATIC_SHELL_DEBUGGING` is
65 // set to `1`. Otherwise the following is optimized out.
66 if (process.env.__NEXT_EXPERIMENTAL_STATIC_SHELL_DEBUGGING === '1') {
67 const search = new URLSearchParams(window.location.search)
68 if (
69 search.get('__nextppronly') === 'fallback' ||
70 search.get('__nextppronly') === '1'
71 ) {
72 console.warn(
73 `Skipping hydration due to __nextppronly=${search.get('__nextppronly')}`
74 )
75 return
76 }
77 }
78
79 hydrate(assetPrefix)
80 })
81}

Callers 3

app-next.tsFile · 0.90
app-next-dev.tsFile · 0.90

Calls 5

getAssetPrefixFunction · 0.90
loadScriptsInSequenceFunction · 0.85
hydrateFunction · 0.70
getMethod · 0.65
warnMethod · 0.45

Tested by

no test coverage detected