sveltejs / vite-plugin-svelte

Svelte plugin for http://vitejs.dev/
MIT License
864 stars 105 forks source link

Sourcemap for [file] point to missing source files #569

Closed omar-abdul closed 1 year ago

omar-abdul commented 1 year ago

Describe the bug

Whenever I declare vitePreprocess as my preprocessor I get these warnings for al my pages and components

Sourcemap for "/mnt/Omo Stuff/from stuff/web-svelte/site/src/lib/posts/first-post.md" points to missing source files Sourcemap for "/mnt/Omo Stuff/from stuff/web-svelte/site/src/routes/+layout.svelte" points to missing source files Sourcemap for "/mnt/Omo Stuff/from stuff/web-svelte/site/src/routes/+page.svelte" points to missing source files Sourcemap for "/mnt/Omo Stuff/from stuff/web-svelte/site/src/lib/components/BlogCard.svelte" points to missing source files

Once I change it back to svelte-preprocess the errors go away,

Reproduction URL

https://github.com/omar-abdul/viteissue

Reproduction

Change svelte-preprocess with vitePreprocess

/** @type {import('@sveltejs/kit').Config} */
const config = {
    // Consult https://github.com/sveltejs/svelte-preprocess
    // for more information about preprocessors
    // preprocess: [preprocess({ postcss: true })],
    preprocess:[vitePreprocess(),mdsvex({extensions:['.md']})],
    extensions :['.svelte','.md'],

    kit: {
        adapter: adapter(),

    },

}; 

Logs

shell
`Sourcemap for "/mnt/Omo Stuff/from stuff/web-svelte/site/src/lib/posts/first-post.md" points to missing source files
Sourcemap for "/mnt/Omo Stuff/from stuff/web-svelte/site/src/routes/+layout.svelte" points to missing source files
Sourcemap for "/mnt/Omo Stuff/from stuff/web-svelte/site/src/routes/+page.svelte" points to missing source files
Sourcemap for "/mnt/Omo Stuff/from stuff/web-svelte/site/src/lib/components/BlogCard.svelte" points to missing source files`

System Info

Node version 19.3.0
NPM version 9.2.0

vite version 4.0.0
svelte-preprocess version : 4.10.7
dominikg commented 1 year ago

This seems to be caused by spaces in the directory names of parent directories.

workaround: don't use spaces. Will have to investigate and see if there is something vite-plugin-svelte has to encode or if it is on vite itself to do something about it.

> space-test@0.0.1 dev /home/dominikg/develop/reproductions/space test
> vite dev

Forced re-optimization of dependencies

  VITE v4.0.3  ready in 521 ms

  ➜  Local:   http://localhost:5173/
  ➜  Network: use --host to expose
  ➜  press h to show help
Sourcemap for "/home/dominikg/develop/reproductions/space test/src/routes/Counter.svelte" points to missing source files
9:55:23 AM [vite-plugin-svelte] ssr compile done.
package     files     time     avg
space-test      5   69.5ms  13.9ms
is 📦 v0.0.1 via  v18.11.0 took 1m51s 
develop/reproductions/space test ❯ cd ..

~/develop/reproductions ❯ mv space\ test/ space_test

~/develop/reproductions ❯ cd space_test/
is 📦 v0.0.1 via  v18.11.0 
develop/reproductions/space_test ❯ pnpm dev

> space-test@0.0.1 dev /home/dominikg/develop/reproductions/space_test
> vite dev

  VITE v4.0.3  ready in 507 ms

  ➜  Local:   http://localhost:5173/
  ➜  Network: use --host to expose
  ➜  press h to show help
9:57:30 AM [vite-plugin-svelte] ssr compile done.
package     files     time     avg
space-test      5   62.1ms  12.4ms
is 📦 v0.0.1 via  v18.11.0 took 14s 
develop/reproductions/space_test ❯ 
omar-abdul commented 1 year ago

@dominikg its exactly that, I don't know how you figured it out, pretty cool