File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,19 @@ module.exports = ({ types: t }) => ({
29
29
)
30
30
)
31
31
) ,
32
+ t . expressionStatement (
33
+ t . callExpression (
34
+ t . memberExpression (
35
+ t . identifier ( 'Object' ) , t . identifier ( 'defineProperty' ) ) ,
36
+ [
37
+ t . identifier ( 'exports' ) ,
38
+ t . stringLiteral ( '__esModule' ) ,
39
+ t . objectExpression ( [
40
+ t . objectProperty ( t . identifier ( 'value' ) , t . booleanLiteral ( true ) )
41
+ ] )
42
+ ]
43
+ )
44
+ ) ,
32
45
t . expressionStatement (
33
46
t . assignmentExpression ( '=' ,
34
47
expr . node . left , t . identifier ( 'exports' )
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ export default function tweakDefault() {
7
7
var matches = / ^ ( e x p o r t s (?: \[ ' d e f a u l t ' ] | \. d e f a u l t ) ) = ( .* ) ; $ / . exec ( line ) ;
8
8
if ( matches ) {
9
9
lines [ i ] = 'module.exports = exports = ' + matches [ 2 ] + ';\n' +
10
+ 'Object.defineProperty(exports, "__esModule", { value: true });\n' +
10
11
matches [ 1 ] + ' = exports;' ;
11
12
break ;
12
13
}
You can’t perform that action at this time.
0 commit comments