-
-
Notifications
You must be signed in to change notification settings - Fork 260
Open
Description
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 the esbuild
sourcemap input to be:
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],
});
Metadata
Metadata
Assignees
Labels
No labels