Nested Vue component does not render when bundled separately using Webpack for Options API #12907
-
Vue version3.5.13 (also tested on 3.3.11) Link to minimal reproductionhttps://github.com/gerteck/vue-render-bug Steps to reproduce
Actual Behavior: When Vue components are bundled separately (using Webpack) and imported into the server-side code, the nested components do not render as expected. The output is missing the content of the child component (Test2Component), but the parent component (TestComponent) is rendered. What is expected?Expected Behavior: The nested Vue component (e.g., What is actually happening?When Vue components are bundled separately (using Webpack) and imported into the server-side code, the nested components do not render as expected. The output is missing the content of the child component ( The child component is rendered as a empty comment. Also getting the relevant errors (tested on separate setup)
System Infonode v20.16.0 Any additional comments?
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I don't think this is a bug in Vue Core, I think it's just a problem with the webpack config. The warnings you're seeing typically indicate that there are two copies of Vue being used at runtime. The Vue application is using one copy of Vue but a component within it is using a different copy. As a result, functions like In the Composition API example you're importing From a quick look through the files, it seems that I haven't used webpack for a while, but I think you need to add Vue to the |
Beta Was this translation helpful? Give feedback.
I don't think this is a bug in Vue Core, I think it's just a problem with the webpack config.
The warnings you're seeing typically indicate that there are two copies of Vue being used at runtime. The Vue application is using one copy of Vue but a component within it is using a different copy. As a result, functions like
resolveComponent
fail because they rely on global context variables being set, but those are set within the other copy of Vue. Other functions, likeprovide
andinject
, would fail in a similar manner if you were using them.In the Composition API example you're importing
Test2
directly, so it no longer relies onresolveComponent
. That dodges the issue, but it isn't really …