Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slots don't work on compiled SFC when imported to a client project #4083

Closed
loadpixels opened this issue Jul 8, 2021 · 3 comments
Closed

Comments

@loadpixels
Copy link

Version

3.1.4

Reproduction link

https://github.com/loadpixels/slots-example

Steps to reproduce

What is expected?

the slots are populated with the content you provide

What is actually happening?

nothing - the slot is never populated, also styles disappear - but i think that's probably a different problem


I've noted that when running on Vite - it works as expected in Development mode, but not when it's built. It doesn't work at all on a project generated by vue-cli

Slot data is still rendered if you use a pure .ts component with a render function - this only appears to affect Single File Components

I've run the same repo steps above using Vue 2 and confirmed everything works.

I can't be absolutely certain that it's not the fault of the above libraries - but vue-rollup-sfc produces working slots when used with Vue 2

@posva
Copy link
Member

posva commented Jul 8, 2021

Open an issue in the two repositories or open an issue that doesn't use those repositories. If the bug is within vue compiler, you should be able to use https://sfc.vuejs.org to generate the js and copy paste on the same website to create sharable reproduction

@posva posva closed this as completed Jul 8, 2021
@skirtles-code
Copy link
Contributor

skirtles-code commented Jul 9, 2021

I haven't checked your repo in detail but from the symptoms I suspect you're pulling in two copies of Vue. See #2064 (comment) for a possible solution.

@loadpixels
Copy link
Author

@skirtles-code - yes your diagnosis was correct I found the answer here last night vitejs/vite#4089

Turns out it was because of how I was installing my library locally - if I npm pack my library and then install the resulting .tgz file it works perfectly

@github-actions github-actions bot locked and limited conversation to collaborators Oct 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants