unplugin / unplugin-vue-ce

🍒 A vue plugin that extends vue's Custom Element capabilities
MIT License
75 stars 3 forks source link

2x nested defineAsyncComponent #63

Closed SavkaTaras closed 1 year ago

SavkaTaras commented 1 year ago

Hello, I hope you are doing well.

Could you please take a look at the logic you're running when defineAsyncComponent is used.

The specific bug happens in this case: component-a uses defineAsyncComponent component-b. component-b uses defineAsyncComponent component-c.

When using , styles from don't come through, because of one if statement.

Is it possible to recursively get all components on async and get their styles up to the root element? Maybe MutationObserver could help solving the issue?

Anyways, if we have to switch to import actual component instead of defineAsyncComponent import that is fine, but it would be great to get this working since some people might ask for it.

Thank you for all your work, you've been great.

I've update the repo to reproduce the issue: https://github.com/SavkaTaras/vue-cue-issues

Component C (custom element: component-z): https://github.com/SavkaTaras/vue-cue-issues/blob/master/src/components/ComponentC/ComponentC.vue

Component B (custom element: component-y): https://github.com/SavkaTaras/vue-cue-issues/blob/master/src/components/ComponentB/ComponentB.vue

Component A (custom element: component-x): https://github.com/SavkaTaras/vue-cue-issues/blob/master/src/components/ComponentA/ComponentA.vue

Please run

npm install
npm run build
npm run dev

Best regards, Taras

SavkaTaras commented 1 year ago

@baiwusanyu-c thank you so much!