Open jd-carroll opened 1 month ago
Under a very specific circumstance, the generated output from esbuild does not contain the //# sourceMappingURL= reference.
esbuild
//# sourceMappingURL=
If you write a simple plugin to rename the files on end, example below, the output does not contain the source map link.
However, if I go into node_modules and force the esbuild sourcemap input to be:
node_modules
sourcemap: 'linked',
It will work as expected.
Please update the types of sourcemap to be:
sourcemap?: boolean | 'inline' | 'linked';
With an implementation of:
sourcemap: options.sourcemap === true ? "external" : typeof options.sourcemap === 'string' ? options.sourcemap : false,
Here is an example plugin (you'll need to adapt for a working example):
const RenameOnEnd: Plugin = { name: 'rename-on-end', setup(build) { build.onEnd((result) => { for (const file of result.outputFiles || []) { if (file.path.endsWith('.js.map')) { continue; } file.path = file.path + '.special.js'; } }); } }; export default defineConfig({ entry: ['lambdas/*/*-handler.ts'], splitting: true, target: 'esnext', sourcemap: true, format: ['esm'], clean: true, outDir: 'dist/lambdas', esbuildPlugins: [RenameOnEnd], });
Related Issues:
Under a very specific circumstance, the generated output from
esbuild
does not contain the//# sourceMappingURL=
reference.If you write a simple plugin to rename the files on end, example below, the output does not contain the source map link.
However, if I go into
node_modules
and force theesbuild
sourcemap input to be:It will work as expected.
Please update the types of sourcemap to be:
With an implementation of:
Here is an example plugin (you'll need to adapt for a working example):
Related Issues:
775
495
Upvote & Fund