I'm trying to dig into Svelte 3 (v3.7.1) and it works quite well ... with a few stumbling blocks when it comes to including external CSS (bootstrap).
But nevertheless, one thing I cannot seem to wrap my head around is debugging the svelte app in my browser
I found a post on svelte github issues that stated that I just need to include {@debug}
somewhere in my code in order to make the browser break at "that point" so I can debug and inspect current state.
But: This does not work at all. Even though the {@debug}
is present, there is no breaking even though I have the developer tools open.
What do I have to do in order to debug my code?
EDIT: I figured you needed to know about my setup
I use a node/express web server that serves the compiled svelte client as app.use(express.static('svelteclient/public'))
from the svelte project's subfolder.
Code excerpt:
<script>
import { onMount } from 'svelte';
let searches = ["angular", "deno", "svelte", "stencil"];
let tweets = {};
let currentImage = null;
let currentYTUrl = "";
for(let search of searches) {
tweets[search] = [];
}
let socket = io();
let modal = null;
let ytmodal = null;
onMount(() => {
modal = UIkit.modal('#mymodal');
ytmodal = UIkit.modal('#myytmodal');
});
...
</script>
<style>
.uk-panel-badge .uk-badge {
cursor: pointer;
}
</style>
{@debug}
<div class="uk-grid" data-uk-grid-margin>
{#each searches as search}
<div class={'uk-width-medium-1-' + searches.length}>
...
</div>
{/each}
</div>
Chrome version is 75.0.3770.142
dev: true
, otherwise{@debug ...}
tags will be stripped out – Borchertdev: true
in rollup.config.js -> plugins -> svelte() ... it doesn't work. But I found a way ... justnpm run dev
and then immediately stop the live reload server – Pembrokedev: true
works if you also prevent the terser() plugin from running – Pembroke