Skip to content

Source maps in adapter-node #2517

Description

@alastaircoote

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions