sveltejs/template

Dev server can't find *.ts files

Janekdererste opened this issue · 4 comments

Thanks for the nice template. It is really simple to get started with this.

I have a problem when setting up the project with typescript though. I can't view the sources of my normal typescript files (with .ts extension) in the dev tools of either chrome and firefox. Chrome gives the following error message when I try to view main.ts in the Debugger:

Could not load content for http://localhost:5000/src/main.ts (HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE)

The code within the files seems to be properly executed though.

My first guess would be, that the code from *.ts files is not properly included in the code map.

Any help would be appreceated.

orta commented

Maybe we need to be generating source maps?

The problem is that the rollup plugin does not include the source in the source map and only points to the source file. That source file is not part of what sirv serves (only stuff inside public is). So either sirv needs to also watch the src folder somehow, or we copy over all ts files into public, or we get the rollup plugin to add the source inline into the sourcemap.

This is also what I'm seeing. In the console, I see this and the sourcemap of the ts files outside of the svelte components are not available. This make me unable to debug the ts code in the browser.

image

#173 will fix this