inject() can only be used inside setup()
when building app with esbuild
#11200
-
I'm trying to set up the most basic possible app with esbuild, Vue, and FormKit, and I'm having trouble getting it to work, even though I've pared my code down to just 4 lines of JS copied from the FormKit documentation, and the exact same code works when I run it using ES modules. The errors I get from Vue are
I'm really struggling to understand why the second one works but the first doesn't. It feels like it might be related to using esbuild, since as far as I can tell everything else (the HTML, JS, and versions of Vue and FormKit) are the same. I realize this might be a FormKit issue but I'd love any insight as to why I might be seeing different behaviour when running the code with esbuild vs using ES modules in the browser! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
You are importing from a different build version of Vue than formkit does (it just imports from So your build includes two different copies of Vue in your bundle, which then conflict at runtime because Vue relies on some singletons for effect tracking etc |
Beta Was this translation helpful? Give feedback.
-
Would it be possible for Vue to provide a more helpful error message when there are 2 different copies of Vue in a bundle than |
Beta Was this translation helpful? Give feedback.
You are importing from a different build version of Vue than formkit does (it just imports from
'vue'
)So your build includes two different copies of Vue in your bundle, which then conflict at runtime because Vue relies on some singletons for effect tracking etc