MIME type errors with Netlify Dev and Svelte Kit

Netlify domain: balacamp.netlify.app

My website runs fine locally, without console errors, using svelte-kit dev. It also deploys without issues.
My issue is with trying to run the development environment with netlify dev.
The console output doesn’t show any error, but when trying to load the page at localhost:8888, I’m seeing these errors in the console:

For reference, this is my netlify.toml:

  command = "npm run build"
  publish = "build"

  command = "svelte-kit dev"
  • I am using the latest versions of sveltejs/adapter-netlify (1.0.0-next.51), sveltejs/vite-plugin-svelte (1.0.0-next.40) and vite (2.8.6)
  • I have tried this setup with node v14.15.0 and v16.14.2. Same errors.

Hey there, @nimser :wave:

Thanks for reaching out. I am not seeing the MIME type errors on our end, as we cannot reproduce an issue you are seeing locally. Can you share a reproduction or a repository with us so that we can look into this further?

Additionally, in the interim, can you try removing your [dev] command and running the build without it? Does it build successfully when you do this?

I managed to pinpoint the issue to @sveltejs/adapter-netlify.
I can reproduce the issue replacing back and forth with @sveltejs/adapter-auto to make the issue disappear/reappear.
Meaning, it works with @sveltejs/adapter-auto, but I get the above errors with @sveltejs/adapter-netlify, even though the adapter-netlify version used as a dependency of adapter-auto is the same (1.0.0-next.51).

I’m confused as the reason for this as I would have assumed netlify dev to make use of adapter-netlify?
One thing I noticed is that with the same config, when I netlify build with adapter-netlify I get content ouputed in /build/. Running netlify dev at that point would result in above issues. Interestingly, removing the build folder fixes these (it seems both the SSR part and the client are generated in the .svelte-kit folder by the svelte-kit build command, so I’m not sure why there should be a build folder anyway?).
When I run netlify build with adapter-auto, it doesn’t create a /build folder, and everything works as expected. It would be great to have more information available about how build steps differ in the netlify dev environement and the production environment.

In both case, my netlify.toml reads as follows:

  command = "svelte-kit build"
  publish = "build"

PS: I tried to work on a reproducible example but the errors varied slightly, repo can’t be shared as-is. I can share specific files upon request.

Hey there, @nimser :wave:

We have looked into this further for you. Unfortunately, as we are not the maintainers of @sveltejs/adapter-netlify, your best path forward here will be speaking directly with the plugin maintainers. I believe bringing them a reproduction would be beneficial as well (although I know you stated this was a challenge).

We’ll leave this thread open should anything change in the future!