Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ export default function(this: loader.LoaderContext, source: string, sourceMap?:

// Instrument the code
let instrumenter = createInstrumenter(options);
instrumenter.instrument(source, this.resourcePath, done.bind(this), sourceMap);
if (sourceMap !== undefined) {
const { ...sourceMapPlainObject } = sourceMap;
instrumenter.instrument(source, this.resourcePath, done.bind(this), sourceMapPlainObject);
}
else {
instrumenter.instrument(source, this.resourcePath, done.bind(this), undefined);
}

function done(this: loader.LoaderContext, error: Error | null, instrumentedSource: string) {
// Get the source map for the instrumented code
Expand Down