Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do i debug svelte compiler?

Tags:

svelte

I'm trying to build and debug svelte source code to learn svelte internal better.

The code runs as expected. The problem appears when I use the svelte compiler on a plain old JavaScript file and trying to debug it with VSCode.

It seems that the debugger fails to read the source map file.

The debugger highlights / read compiler.js (compiled one) but I want to debug the .ts one instead of the compiled file.

Here's the code :

// playsv.js
const sv = require('./compiler')
const str = '<h1>text</h1>'
// get ast
const ast = sv.parse(str)

Thanks

like image 979
athxp Avatar asked Jun 28 '26 20:06

athxp


1 Answers

Based on @UnLoCo answer.

I have to do is:

  1. Clone sveltejs/svelte
  2. npm run build
  3. npm link
  4. After that, go back to the project folder and run npm link svelte
like image 156
athxp Avatar answered Jun 30 '26 12:06

athxp



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!