Skip to content

Commit 3b6fc3e

Browse files
committed
fix: πŸ› babel inputSourceMap object
βœ… Closes: #215
1 parent 5c4e7c6 commit 3b6fc3e

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

Diff for: β€Žsrc/transformers/babel.ts

+9-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { transformAsync } from '@babel/core';
1+
import { transformAsync, TransformOptions } from '@babel/core';
22

33
import { Transformer, Options } from '../types';
44

@@ -8,17 +8,22 @@ const transformer: Transformer<Options.Babel> = async ({
88
options,
99
map = undefined,
1010
}) => {
11-
const { code, map: sourcemap } = await transformAsync(content, {
11+
const babelOptions = {
1212
...options,
13-
inputSourceMap: map as any,
13+
inputSourceMap:
14+
typeof map === 'string' ? JSON.parse(map) : map ?? undefined,
1415
sourceType: 'module',
1516
// istanbul ignore next
1617
sourceMaps: !!options.sourceMaps,
1718
filename,
1819
minified: false,
1920
ast: false,
2021
code: true,
21-
});
22+
} as TransformOptions;
23+
24+
console.log(babelOptions);
25+
26+
const { code, map: sourcemap } = await transformAsync(content, babelOptions);
2227

2328
return {
2429
code,

0 commit comments

Comments
Β (0)