Open finestgecko opened 2 years ago
Thanks for the report. I found this SvelteKit issue which has a lot of useful context as well: https://github.com/sveltejs/cli/issues/205
Since there's a workaround & most Svelte projects don't use webpack, I'm not going to prioritize this just yet. Hopefully in the meantime the guidance for library authors will become a little clearer.
Describe the bug
I'm using Webpack 5 (via
@symfony/webpack-encore
) and getting a bunch of errors when I import the components. It seems to be a common problem.npm install -D @rgossiaux/svelte-headlessui
Which results in lots of errors like this:
and lots like this:
and, crucially, this:
To reproduce
Node.js version:
svelte-headlessui
version:webpack-encore
version:(which internally uses Webpack
^5.7.2
)The fix
One of the errors suggested this:
Adding
.js
to the imports seems to solve the problem.Update: For anyone else facing this problem, a better solution might be to add
fullySpecified: false
towebpack.config.js
.(props to this comment for the solution)