nextjs - ✅(Solved) Fix ReferenceError: _self___NEXT_DATA___autoExport is not defined on next dev (16.1.4) [2 pull requests, 13 comments, 12 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#88780Fetched 2026-04-08 02:03:59
View on GitHub
Comments
13
Participants
12
Timeline
49
Reactions
12

Error Message

index.tsx:315 Uncaught ReferenceError: _self___NEXT_DATA___autoExport is not defined at AppContainer (index.tsx:315:27) at Object.react_stack_bottom_frame (react-dom-client.development.js:25904:20) at renderWithHooks (react-dom-client.development.js:7662:22) at updateFunctionComponent (react-dom-client.development.js:10166:19) at beginWork (react-dom-client.development.js:11778:18) at runWithFiberInDEV (react-dom-client.development.js:871:30) at performUnitOfWork (react-dom-client.development.js:17641:22) at workLoopSync (react-dom-client.development.js:17469:41) at renderRootSync (react-dom-client.development.js:17450:11) at performWorkOnRoot (react-dom-client.development.js:16583:35) at performWorkOnRootViaSchedulerTask (react-dom-client.development.js:18957:7) at MessagePort.performWorkUntilDeadline (scheduler.development.js:45:48)

Fix Action

Fix / Workaround

// The declaration is moved down into a nested Component function: Component: function() { var _self___NEXT_DATA___autoExport; return null; }

  Workarounds:

PR fix notes

PR #1629: fix(deps): bump next to 16.1.4 and react to 19.2.3

Description (problem / solution / changelog)

Also removed browserslist from package.json due to: https://github.com/vercel/next.js/issues/88780

Changed files

  • ui/package-lock.json (modified, +41/-35)
  • ui/package.json (modified, +2/-14)

PR #1063: [code-infra] Fix code infra dashboard

Description (problem / solution / changelog)

Getting similar errors like https://github.com/vercel/next.js/issues/88780 since last Next.js upgrade.

Downgrading fixes the issue.

Improved a bit the code for ColorSchemeSelector as well

Changed files

  • apps/code-infra-dashboard/package.json (modified, +1/-1)
  • apps/code-infra-dashboard/src/components/ColorSchemeSelector.tsx (modified, +13/-19)
  • apps/code-infra-dashboard/src/views/DiffPackage.tsx (modified, +9/-11)
  • docs/package.json (modified, +3/-3)
  • package.json (modified, +1/-1)
  • packages/docs-infra/package.json (modified, +1/-1)
  • pnpm-lock.yaml (modified, +62/-60)

Code Example

index.tsx:315 Uncaught ReferenceError: _self___NEXT_DATA___autoExport is not defined
    at AppContainer (index.tsx:315:27)
    at Object.react_stack_bottom_frame (react-dom-client.development.js:25904:20)
    at renderWithHooks (react-dom-client.development.js:7662:22)
    at updateFunctionComponent (react-dom-client.development.js:10166:19)
    at beginWork (react-dom-client.development.js:11778:18)
    at runWithFiberInDEV (react-dom-client.development.js:871:30)
    at performUnitOfWork (react-dom-client.development.js:17641:22)
    at workLoopSync (react-dom-client.development.js:17469:41)
    at renderRootSync (react-dom-client.development.js:17450:11)
    at performWorkOnRoot (react-dom-client.development.js:16583:35)
    at performWorkOnRootViaSchedulerTask (react-dom-client.development.js:18957:7)
    at MessagePort.performWorkUntilDeadline (scheduler.development.js:45:48)

---

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.0.0: Wed Sep 17 21:41:50 PDT 2025; root:xnu-12377.1.9~141/RELEASE_ARM64_T6030
  Available memory (MB): 36864
  Available CPU cores: 12
Binaries:
  Node: 24.13.0
  npm: 11.6.2
  Yarn: 1.22.22
  pnpm: 10.28.1
Relevant Packages:
  next: 16.1.4 // Latest available version is detected (16.1.4).
  eslint-config-next: N/A
  react: 19.2.3
  react-dom: 19.2.3
  typescript: 5.9.3
Next.js Config:
  output: N/A

---

"browserslist": {
    "development": ["last 2 versions"],
    "production": ["chrome 72"]
  }

---

function AppContainer(param) {
    var children = param.children;
    _s();
    var adaptedForAppRouter = _react.default.useMemo(...);
    var _self___NEXT_DATA___autoExport;
    return /*#__PURE__*/ (0,_jsxruntime.jsx)(_adapters.PathnameContextProviderAdapter, {
      router: router,
      isAutoExport: (_self___NEXT_DATA___autoExport = self.__NEXT_DATA__.autoExport) !== null && _self___NEXT_DATA___autoExport !== void 0 ? _self___NEXT_DATA___autoExport : false,
      ...
    });
  }

---

function AppContainer(param) {
    var children = param.children;
    _s();
    var adaptedForAppRouter = _react.default.useMemo(...);
    return /*#__PURE__*/ (0,_jsxruntime.jsx)(_adapters.PathnameContextProviderAdapter, {
      router: router,
      isAutoExport: (_self___NEXT_DATA___autoExport = self.__NEXT_DATA__.autoExport) !== null && _self___NEXT_DATA___autoExport !== void 0 ? _self___NEXT_DATA___autoExport : false,
      ...
    });
  }

  // The declaration is moved down into a nested Component function:
  Component: function() {
    var _self___NEXT_DATA___autoExport;
    return null;
  }
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/leeeunsang-tmobi/next-reproduction-16.1.4

To Reproduce

  1. pnpm install
  2. pnpm dev

Current vs. Expected behavior

Actual behavior: next dev starts successfully, but the browser throws a runtime script error on load:

index.tsx:315 Uncaught ReferenceError: _self___NEXT_DATA___autoExport is not defined
    at AppContainer (index.tsx:315:27)
    at Object.react_stack_bottom_frame (react-dom-client.development.js:25904:20)
    at renderWithHooks (react-dom-client.development.js:7662:22)
    at updateFunctionComponent (react-dom-client.development.js:10166:19)
    at beginWork (react-dom-client.development.js:11778:18)
    at runWithFiberInDEV (react-dom-client.development.js:871:30)
    at performUnitOfWork (react-dom-client.development.js:17641:22)
    at workLoopSync (react-dom-client.development.js:17469:41)
    at renderRootSync (react-dom-client.development.js:17450:11)
    at performWorkOnRoot (react-dom-client.development.js:16583:35)
    at performWorkOnRootViaSchedulerTask (react-dom-client.development.js:18957:7)
    at MessagePort.performWorkUntilDeadline (scheduler.development.js:45:48)

Expected behavior: next dev starts successfully and the page loads without browser‑side runtime errors.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.0.0: Wed Sep 17 21:41:50 PDT 2025; root:xnu-12377.1.9~141/RELEASE_ARM64_T6030
  Available memory (MB): 36864
  Available CPU cores: 12
Binaries:
  Node: 24.13.0
  npm: 11.6.2
  Yarn: 1.22.22
  pnpm: 10.28.1
Relevant Packages:
  next: 16.1.4 // Latest available version is detected (16.1.4).
  eslint-config-next: N/A
  react: 19.2.3
  react-dom: 19.2.3
  typescript: 5.9.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Pages Router

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

Regression:

  • Works on 16.1.1
  • Also works on 16.1.4 if I remove package.json#browserslist or override @next/[email protected].

Browserslist config:

  "browserslist": {
    "development": ["last 2 versions"],
    "production": ["chrome 72"]
  }

Diff notes The var _self___NEXT_DATA___autoExport declaration moved out of AppContainer and into a nested Component function in 16.1.4 but the AppContainer still uses the variable. This change causes the browser‑side error index.tsx:315 Uncaught ReferenceError: _self___NEXT_DATA___autoExport is not defined.

working

  function AppContainer(param) {
    var children = param.children;
    _s();
    var adaptedForAppRouter = _react.default.useMemo(...);
    var _self___NEXT_DATA___autoExport;
    return /*#__PURE__*/ (0,_jsxruntime.jsx)(_adapters.PathnameContextProviderAdapter, {
      router: router,
      isAutoExport: (_self___NEXT_DATA___autoExport = self.__NEXT_DATA__.autoExport) !== null && _self___NEXT_DATA___autoExport !== void 0 ? _self___NEXT_DATA___autoExport : false,
      ...
    });
  }

broken

  function AppContainer(param) {
    var children = param.children;
    _s();
    var adaptedForAppRouter = _react.default.useMemo(...);
    return /*#__PURE__*/ (0,_jsxruntime.jsx)(_adapters.PathnameContextProviderAdapter, {
      router: router,
      isAutoExport: (_self___NEXT_DATA___autoExport = self.__NEXT_DATA__.autoExport) !== null && _self___NEXT_DATA___autoExport !== void 0 ? _self___NEXT_DATA___autoExport : false,
      ...
    });
  }

  // The declaration is moved down into a nested Component function:
  Component: function() {
    var _self___NEXT_DATA___autoExport;
    return null;
  }

Workarounds:

extent analysis

TL;DR

The most likely fix is to override @next/swc-darwin-arm64 to version 16.1.1 to resolve the issue with the moved _self___NEXT_DATA___autoExport declaration.

Guidance

  • The error occurs due to the _self___NEXT_DATA___autoExport variable being declared inside a nested component function, making it inaccessible to the AppContainer function.
  • To verify the issue, check the browser console for the Uncaught ReferenceError and inspect the code to see if the _self___NEXT_DATA___autoExport variable is declared in a scope that is not accessible to the AppContainer function.
  • As a temporary workaround, removing the browserslist configuration from package.json or downgrading @next/swc-darwin-arm64 to version 16.1.1 can resolve the issue.
  • It is recommended to override @next/swc-darwin-arm64 to version 16.1.1 as a more targeted solution.

Example

No code example is provided as the issue is related to a specific version of @next/swc-darwin-arm64 and the fix involves overriding the version.

Notes

The issue is specific to the 16.1.4 version of Next.js and the darwin-arm64 architecture. The fix may not be applicable to other versions or architectures.

Recommendation

Apply the workaround by overriding @next/swc-darwin-arm64 to version 16.1.1, as this is a more targeted solution that addresses the specific issue with the moved _self___NEXT_DATA___autoExport declaration.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING