pablo-abc / svelte-markdown

Markdown parser to svelte components
MIT License
360 stars 50 forks source link

Vite can't resolve marked when using pnpm on sveltekit #27

Closed ceifa closed 2 years ago

ceifa commented 3 years ago

I'm converting my project to use pnpm instead of regular npm, but when I tried to run the project I received the following error:

Failed to resolve force included dependency: svelte-markdown > marked

And I fixed it adding this property to svelte.config.js (a workaround):

{
    "vite": {
        "optimizeDeps": {
            "exclude": ["marked"]
        }
    }
}

I have a lot of dependencies and svelte-markdown was the only one with this problem, so I'm guessing it is something that should be fixed here, but I really don't know.

pablo-abc commented 3 years ago

This had been solved previously by importing directly from the ESM build of marked. But this caused a whole lot of other issues in other environments, so this is the appropriate way to use this package with Vite/SvelteKit until a better solution comes along.

Thanks for the issue report! It did show that this is something that should, at least, be documented in the README.

FunMiles commented 2 years ago

I hit the exact same problem. At least I am glad to see there's a workaround.

Raicuparta commented 2 years ago

32 should solve this by updating marked

ceifa commented 2 years ago

Fixed in 0.2.0