nuxt / nuxt/bridge

useNuxtApp is not defined after build

Open
#1,268 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

workaround available
Dominant language
TypeScript
Stars
285
Forks
33
Avg merge
22h 38m
Merged PRs (30d)
3

Description

Environment
  • Operating System: Darwin
  • Node Version: v20.15.1
  • Nuxt Version: 2.17.4
  • CLI Version: 3.11.1
  • Nitro Version: 2.9.7
  • Package Manager: npm@10.8.2
  • Builder: webpack
  • User Config: bridge, ssr, modern, telemetry, components, head, loading, build, publicRuntimeConfig, serverHandlers, devServerHandlers, devServer, typescript, nitro, buildModules
  • Runtime Modules: -
  • Build Modules: (), @nuxt/bridge@3.2.0
Reproduction

https://github.com/tresorone/tresor-repro

Describe the bug

As part of our nuxt 2 to nuxt 3 migration we ran across an error where useNuxtApp is not defined in our build, while it works fine in dev.

To reproduce:

  1. Clone the reproduction repo
  2. npm i
  3. npm run build
  4. npm start
  5. open localhost:3000 in your browser and open the javascript console

You should see the error useNuxtApp is not defined.

Additional context

No response

Logs

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Clone the linked tresorone/tresor-repro repository and follow the reported npm install, npm run build, and npm start steps. Inspect the production build behavior around the Nuxt Bridge configuration and compare it with development, then verify that opening localhost:3000 no longer reports “useNuxtApp is not defined” in the browser console.

Written by the indexing model from the issue text.

Assessment

Tech stack
nuxt, webpack
Domain
build-system, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.