sveltejs/template-webpack

Dealing with external svelte components

kaisermann opened this issue · 3 comments

Since we're excluding /node_modules/ from the svelte-loader, what's the best way to use external svelte components like svelte-routing?

Adding a negative lookahead to the exclusion rule kinda works, but can we assume that every svelte component/package will have the svelte prefix?

{
  test: /\.(html|svelte)$/,
  exclude: /node_modules\/(?!svelte)/,
  ...
}

I actually hit this earlier today. I just removed the exclude field altogether in the project I'm working on. The svelte- prefix assumption is probably reasonable, but I don't know if I'd consider it watertight.

This just got me :)

Why exclude node_modules? We're entering a world now where there are a fair few third-party svelte components.

Perhaps there should be a recommendation that Svelte components generally use a .svelte suffix, since .html causes Svelte to break in Parcel bundler, too. Im assuming that Vue uses .vue so that there aren't headaches like this.

Hopefully this is fixed now with #36