sveltejs / rollup-plugin-svelte

Compile Svelte components with Rollup
MIT License
505 stars 79 forks source link

fix package resolution #205

Closed Rich-Harris closed 1 year ago

Rich-Harris commented 1 year ago

I'm not sure what the story is with #198 but it didn't work, because the get_dir function was called inside the catch block which defeats the object.

This PR takes a much simpler approach — it just walks up the tree looking for node_modules/<name>/package.json. Crude, but should work in all the cases we care about (it doesn't need to reimplement the entire Node module resolution algo, it just needs to find libraries with a pkg.svelte).

I assume we also need to respect the svelte export condition, but that seems like something that should happen separately.

dummdidumm commented 1 year ago

From https://github.com/sveltejs/rollup-plugin-svelte#svelte-exports-condition it sounds like the exports condition is already covered