Setting up Svelte-Inspector with VS Code + WSL

Published:
May 10, 2023
October 12, 2023
Updated:
October 12, 2023

Just ran into some issues while setting up the updated svelte-inspector vite plugin on my SvelteKit app I'm developing on Windows with WSL (Windows Subsystem for Linux). Figured I wouldn't be the only one to have this issue so here is a quick way to solve it!

Guide

Setup Svelte Inspector

For SvelteKit inside your svelte.config.js file add this:


//in svelte.config.js
const config = {
  // ...
  vitePlugin: {
    inspector: true,   
  },
}

Add EDITOR config in your settings.json

In your VS Code settings file (settings.json) add the following:


"terminal.integrated.env.linux": { 
   "EDITOR": "code" 
}

That's it, you should now be able to use the svelte-inspector tool with your WSL VS Code editor!

To use it just start your dev server and open up your project in the browser. Then use the default key combo Ctrl + Shift

Image showing svelte inspector working on a skelton sveltekit project

References

Written by...
Mike Karan

I've been a full-stack web developer for 8+ years! Co-host of the HTML All The Things Podcast. Svelte, Vue.js, React, Node, SQL I love all things technology.

More to Read...