athxp
athxp

Reputation: 81

How do i debug svelte compiler?

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

Upvotes: 3

Views: 1486

Answers (1)

athxp
athxp

Reputation: 81

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

Upvotes: 3

Related Questions