unplugin / unplugin-vue-ce

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

When importing the same component twice, the styles only apply to the first one. #49

Closed SavkaTaras closed 1 year ago

SavkaTaras commented 1 year ago

Hello, I hope you are doing well.

I am facing the issue when I include the component twice on the page (index.html). The second copy of the same component doesn't have nested styles.

UPDATE: We build web components using vue lib dev mode. Then we import these components as my-lib.umd.js on index.html vie script tag.

I use Vite 4.2.0 and vue 3.3.4 to build out web components.

Version: "@unplugin-vue-ce/sub-style": "^1.0.0-beta.9",

Thank you.

baiwusanyu-c commented 1 year ago

Hi, can you provide a repository that reproduces the problem? 😀

SavkaTaras commented 1 year ago

Hello,

It's a company resource and I can't, but I will try to create a boogey repo with issue reproduction tomorrow. I will post a url tonight/tomorrow.

Thank you, Taras

baiwusanyu-c commented 1 year ago

This problem seems to be easily reproducible in non-lib mode, but I am not sure, I created a PR for this, and I can only confirm whether this PR is really correct after you provide the repo

SavkaTaras commented 1 year ago

Hello @baiwusanyu-c

Please see repo:

https://github.com/SavkaTaras/vue-cue-issues

Run npm run build

and then

npm run dev

This should provide a result

SavkaTaras commented 1 year ago

Hello @baiwusanyu-c ,

Please let me know if I can help in some way to get this issue resolved. The plugin you created is great, it's just this issue is kind of preventing us from using it.

I and a community really appreciate your hard work.

Thank you, Taras

baiwusanyu-c commented 1 year ago
image
SavkaTaras commented 1 year ago

Thank you so much! That's awesome! I will do some tests later today.