File tree 1 file changed +9
-4
lines changed
1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 1
- import { transformAsync } from '@babel/core' ;
1
+ import { transformAsync , TransformOptions } from '@babel/core' ;
2
2
3
3
import { Transformer , Options } from '../types' ;
4
4
@@ -8,17 +8,22 @@ const transformer: Transformer<Options.Babel> = async ({
8
8
options,
9
9
map = undefined ,
10
10
} ) => {
11
- const { code , map : sourcemap } = await transformAsync ( content , {
11
+ const babelOptions = {
12
12
...options ,
13
- inputSourceMap : map as any ,
13
+ inputSourceMap :
14
+ typeof map === 'string' ? JSON . parse ( map ) : map ?? undefined ,
14
15
sourceType : 'module' ,
15
16
// istanbul ignore next
16
17
sourceMaps : ! ! options . sourceMaps ,
17
18
filename,
18
19
minified : false ,
19
20
ast : false ,
20
21
code : true ,
21
- } ) ;
22
+ } as TransformOptions ;
23
+
24
+ console . log ( babelOptions ) ;
25
+
26
+ const { code, map : sourcemap } = await transformAsync ( content , babelOptions ) ;
22
27
23
28
return {
24
29
code,
You canβt perform that action at this time.
0 commit comments