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

Embed functionality breaks when using Vite import() #511

Open
acidtone opened this issue Sep 5, 2023 · 2 comments
Open

Embed functionality breaks when using Vite import() #511

acidtone opened this issue Sep 5, 2023 · 2 comments

Comments

@acidtone
Copy link

acidtone commented Sep 5, 2023

Describe the bug

sveltekit-embed doesn't embed content when it's rendered as a dynamic markdown import.

To Reproduce

Steps to reproduce the behavior:

  1. Go to Test Page
  2. No YouTube content loads under "Test Page: YouTube Embed"

Expected behavior

YouTube content should load normally.

Additional context

GitHub Repo: https://github.com/acidtone/sveltekit-embed-test/

The above repo is a reproduction of the problem I'm experiencing on a larger markdown website. Content is loaded dynamically using Vite's import() function in /routes/+page.server.js.

The package works great with normal .svelte and .md content but breaks when I import at compile time. This makes sense to me but is there any way around this?

@acidtone acidtone changed the title Dynamic markdown render breaks embed functionality Embed functionality breaks when using Vite import() Sep 5, 2023
@acidtone acidtone changed the title Embed functionality breaks when using Vite import() Embed functionality breaks when using Vite import() Sep 5, 2023
@spences10
Copy link
Owner

Hey @acidtone thanks for stopping by!

So, I'm not sure if this is an MDSveX limitation here or not, short answer is I have no idea! 😅

Sorry,

I think this may be similar situation to what @swyxio was trying to do with swyxio/swyxkit#149

Is there nothing in the terminal to hint at an issue when building or running in dev?

@acidtone
Copy link
Author

acidtone commented Sep 6, 2023

Is there nothing in the terminal to hint at an issue when building or running in dev?

No errors in either the browser or in the terminal. And there's no indication that the page is trying to fetch the YouTube link in the Network tab.

I don't know enough about the lifecycle of Vite/SK/Mdsvex to really know what's going on. I guess the backend compilation isn't triggering the embed by the time it renders in the DOM?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants