Open jak-hammond opened 2 years ago
Did some digging and found a similar issue on the .cjs
file previously which is now successfully detecting the presence of defualt
so it seems it might be a case of implementing that same check in here. I did a quick and dirty check in my own app by simply referencing default
directly and it successfully installs the composition API....obviously that isn't robust like the fix for the prior issue but it does seem to suggest the same root cause.
This seems to be related to Webpacks Module Federation and loading in another Vue app, so potentially an issue conflicting with how the Vue instance is being loaded from there.
I have the same issus Repro: https://github.com/promer94/demi-mf-bug
This problem is more like a webpack bug or capability issue https://github.com/webpack/webpack/issues/16060
Find a workaroud for this problem.
For vue < 2.7
npx vue-demi-switch 2 vue/dist/vue.runtime.esm.js
could change the entry.
For me,set webpack alias can solve the problem;
alias: {
'vue-demi': 'vue-demi/lib/v2/index.cjs',
}
then clear webpack cache(./node_modules/.cache)
and reboot your project.
I am attempting to use Pinia inside a Vue 2.6.14 app, I have followed the steps outline by Pinia to install the Vue Composition API plugin but when the app loads, a piece of code inside Vue Demi is throwing and after taking a look it seems to be that in the case of the Vue 2, the default property needs to be first accessed before the
use
function can be called.