Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source maps in adapter-node #2517

Closed
alastaircoote opened this issue Sep 28, 2021 · 2 comments · Fixed by #2931
Closed

Source maps in adapter-node #2517

alastaircoote opened this issue Sep 28, 2021 · 2 comments · Fixed by #2931
Milestone

Comments

@alastaircoote
Copy link

Describe the problem

Because adapter-node transpiles the original source the error stacks you see in production aren't always that useful in tracking down an issue. I thought it might be as simple as adding source maps to the esbuild config:

esbuild: function (config) {
    config.sourcemap = 'inline';
    return config;
}

which sort of works, but now the source lines it gives me are in .svelte-kit/build/app.js. If I add:

build: {
 	sourcemap: 'inline'
}

to Sveltekit's vite config then .svelte-kit/build/app.js does have source maps but esbuild doesn't merge source maps. I've played a little with the merge-source-maps module but it definitely isn't working with SvelteKit out of the box.

Describe the proposed solution

I'm not entirely sure what the answer is here but wanted to flag it as a desired feature. I'm happy to dig further into it myself but might benefit from the wisdom of someone more familiar with SvelteKit's internals. merge-module-maps fails because it tries to load ${PROJECT_DIR}/kit/dist/node.js which is presumably @svelte/kit/dist/node.js but I'm not totally sure where that's being imported.

Alternatives considered

No response

Importance

nice to have

Additional Information

No response

@benmccann benmccann added this to the 1.0 milestone Sep 28, 2021
@benmccann
Copy link
Member

benmccann commented Oct 1, 2021

The easy solution would probably be to make esbuild bundling optional. It was only added in #1648, so shouldn't be required since we always got away without doing it before.

The better solution is probably to see if we can make Vite responsible for all bundling. The adapter could just be a library and SvelteKit could do all the building instead of the adapter being in charge of the build process. SvelteKit could specify the adapter entry point as the entry point in the Vite build config. It would depend on removing the relative path to the application file #2285 (comment)

@Conduitry
Copy link
Member

I'd hesitate to say we got away without doing it before that PR. @sveltejs/kit was previously a production dependency of all apps using SvelteKit and the Node adapter, which is pretty bad.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants