Cannot access '' before initialization #9686
Replies: 8 comments 3 replies
-
I'm facing the same issue. It occurs when using vue router. This is my import router from './plugins/router';
...
const app = createApp(AppRoot);
app.use(router); // <--- Here is the problem :( With that configuration, it throws:
In my import { createRouter, createWebHistory } from 'vue-router';
import routes from '../routes/routes';
export default createRouter({
history: createWebHistory(),
routes,
}); |
Beta Was this translation helpful? Give feedback.
-
Do you have Circular Dependency on |
Beta Was this translation helpful? Give feedback.
-
I'm having the same issue,I referenced the router in the ts file |
Beta Was this translation helpful? Give feedback.
-
I'm having this issue too and if router is relevant then I'm using the TanStack Router. I took care of circular dependencies but that didn't solve the issue. |
Beta Was this translation helpful? Give feedback.
-
Same here! Quite confusing... |
Beta Was this translation helpful? Give feedback.
-
Same problem |
Beta Was this translation helpful? Give feedback.
-
Encountering same problem here |
Beta Was this translation helpful? Give feedback.
-
Same problem |
Beta Was this translation helpful? Give feedback.
-
I've spent several hours now reviewing existing issues around the error
Cannot access 'ActionTable before initialization
, but none of the existing issues appear to have the same error that I receive.In several of my components, when I save a change, I receive an error similar to above. It's always referencing a component import.
It appears that the
ActionTable
component is being loaded *after theComputerDetailsPage
component, which may be causing theCannot access 'ActionTable before initialization
since ActionTable is loaded after and not before?I've tried detecting circular dependencies, but I cannot find any.
Anyone else experiencing a similar issue?
Posting under discussions because I cannot create a reproduction repo yet
Update:
I am using vue-router v3.5.4, and I believe my issues are stemming from my (perhaps incorrect) use of vue-router.
I have a
router.js
file where I export a router instanceI have helper functions that utilize the router
All components that import
helperFunction
are showing the error I initially posted. However, when I remove the dependency onrouter.js
fromhelpers.js
, the error goes away.I'm almost certain I am incorrectly using the router here, but I haven't noticed any issues with this approach until using vite. Thoughts?
Beta Was this translation helpful? Give feedback.
All reactions