Skip to content

Commit

Permalink
fix: πŸ› babel inputSourceMap object
Browse files Browse the repository at this point in the history
βœ… Closes: #215
  • Loading branch information
kaisermann committed Aug 12, 2020
1 parent 5c4e7c6 commit 3b6fc3e
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/transformers/babel.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { transformAsync } from '@babel/core';
import { transformAsync, TransformOptions } from '@babel/core';

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

Expand All @@ -8,17 +8,22 @@ const transformer: Transformer<Options.Babel> = async ({
options,
map = undefined,
}) => {
const { code, map: sourcemap } = await transformAsync(content, {
const babelOptions = {
...options,
inputSourceMap: map as any,
inputSourceMap:
typeof map === 'string' ? JSON.parse(map) : map ?? undefined,
sourceType: 'module',
// istanbul ignore next
sourceMaps: !!options.sourceMaps,
filename,
minified: false,
ast: false,
code: true,
});
} as TransformOptions;

console.log(babelOptions);

const { code, map: sourcemap } = await transformAsync(content, babelOptions);

return {
code,
Expand Down

0 comments on commit 3b6fc3e

Please sign in to comment.