Splitting stores/main.js
causes an additional app.mount
#2558
Unanswered
hrsa
asked this question in
Help and Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi and thanks for your future advice!
I'm using Pinia in a classic Vue3 app, putting the stores into
assets/js/stores/main.js
, callingapp.use(createPinia());
when mounting and it works flawlessly.The app tends to become rather large, so I started thinking about moving the user dashboard stores (there are several, according to the user type) to its own .js file so the code would be clearer.
Now what i found out is - as soon as i copy some of the stores into
assets/js/stores/dashboard.js
and import them into some of the components - i get two errors.when building with npm run watch -
[BABEL] Note: The code generator has deoptimised the styling of C:\OSP\home\GD\frontend\public\v4\js\app.js as it exceeds the max of 500KB.
in the broser -
[Vue warn]: There is already an app instance mounted on the host container. If you want to mount another app on the same host container, you need to unmount the previous app by calling
app.unmount()first.
The app seems to be mounted twice if there are several files in the
stores
directory, and it looks kinda wrong to me.Of course, all problems disappear as soon as i remove the
dashboard.js
file and keep all the stores inmain.js
.Did you ever run into such problem and have you found a solution?
Beta Was this translation helpful? Give feedback.
All reactions