useNuxtApp is not defined after build
Open
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:
- Clone the reproduction repo
npm inpm run buildnpm start- open
localhost:3000in 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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