Debugging frontend code in VSCode doesn't work (but of course it works in the browser, as usual).Arguably, in development mode, this is no big deal, but it's good to have this on your radar. The solution is likely to leak memory ( source).Here's an example, namely a server code file of the official starter project: You should now be able to debug server-side code in Visual Studio Code or WebStorm. Iį you execute this run configuration in debug mode, you should be able to debug the code right in WebStorm. Then, you can create a run configuration (category: npm ) and choose dev for the run entry. Note that we added our newly added vavite-loader inside the command.įor WebStorm (IntelliJ), you have to edit your package.json directly and change your dev command in the scripts section to vavite-loader vite dev -port 3000 (or whichever port you prefer). In our example, we only do this in development mode, because this is where we want debugging support. Use the loader as plugin in your Īdd the node-loader as plugin to your vite config, before the sveltekit() plugin. pnpm install -D or yarn install -D this, we can activate Node's experimental ESM loader (only in dev mode), which enables sourcemaps and breakpoints on the server. ![]() Install the node-loader from the vavite library. This is apparently an issue with Vite and sourcemaps ( SvelteKit issue, Vite issue).įor this reason, I was thrilled to find out that debugging server code is actually possible - including Typescript support! This works thanks to the vavite library by further ado, here are the simple steps we need to take to get this working: 1. One thing that I personally was always longing for, though, is the possibility to debug server-side code in SvelteKit. Svelte and SvelteKit are amazing, no question about it. Hold down Ctrl when clicking on the URL in the console.press Ctrl + Shift + P and choose "Debug: JavaScript Debug terminal".Pro tip: To debug client-side code conveniently in VS Code as well, ❗️ Update () Server-side code in SvelteKit now works out of the box for some scenarios, so the steps in this article may no longer be needed.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |