"useRouter" and "useRoute" not exported
See original GitHub issueEnvironment
- Operating System:
Linux
- Node Version:
v16.13.0
- Nuxt Version:
3.0.0-27307420.6a25d3e
- Package Manager:
npm@8.1.0
- Bundler:
Vite
- User Config:
meta
,buildModules
,ssr
,srcDir
,css
,publicRuntimeConfig
- Runtime Modules:
-
- Build Modules:
@pinia/nuxt@0.1.5
Reproduction
As the title says, useRouter
and useRoute
can’t be imported
import { useRoute } from '#app';
// useRoute is not exported from the 'app'
Describe the bug
I am trying to import useRoute
as stated here so I can get the path and route name, however, they are not exported.
Currently using a workaround by accessing the router from the useNuxtApp
hook.
Additional context
No response
Logs
SyntaxError: The requested module '/_nuxt/@fs/home/__my_user_dir__/__my_project_folder__/node_modules/nuxt3/dist/app/index.mjs' does not provide an export named 'useRoute'
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
'does not provide an export named 'createRouter'' vue 3, vite ...
I just started using vite with vue. When I'm trying to use vue-router I get the error: SyntaxError: The requested module '/node_modules/.vite/ ...
Read more >Im using VueJs and Laravel8 and i want to import vue-router ...
js :"export 'VueRouter' was not found in 'vue-router'. Im using VueJs and Laravel8 and i want to import vue-router. Her is my app.js...
Read more >Vue Router and the Composition API
Because we don't have access to this inside of setup , we cannot directly ... import { useRouter, useRoute } from 'vue-router' export...
Read more >useRoute - React Navigation
useRoute is a hook which gives access to route object. It's useful when you cannot pass the route prop into the component directly,...
Read more >Using Hooks with React Router - LogRocket Blog
useParams; useNavigate; useLocation; useMatch; useRoutes ... export default function App() { return ( <div className="App"> <BrowserRouter> ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Jasenkoo Can you try
import { useRoute } from '#imports'
?Reopening again (🙈 ) Bridge and Nuxt 3 APIs are supposed to be identical at least when possible which we could make it working always from
#imports