Skip to content

Commit

Permalink
fix: Fix will not export the default module.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Jan 23, 2021
1 parent fe00c74 commit 53cc4c2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 7 additions & 0 deletions example/basic/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ async function testHandle() {
console.log('>>>');
}

(() => {
const { sum } = require('./utils/sum');
const data = { a: 1 };
const result = { ...data };
console.log('>>>', sum(1, result.a));
})();

export default async () => {
const test = new Test();
await testHandle();
Expand Down
3 changes: 1 addition & 2 deletions packages/tsbb/src/babel/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,12 @@ export default (filePath: string, options: ITransformOptions, targets: ITargets)
[
require.resolve('@babel/preset-env'),
{
loose: false,
targets: { node: true },
},
],
require.resolve('@babel/preset-typescript'),
],
plugins: [],
plugins: [require.resolve('babel-plugin-add-module-exports')],
};
}
return new Promise<ITransformResult>((resolve: (value?: ITransformResult) => ITransformResult | any, reject) => {
Expand Down

0 comments on commit 53cc4c2

Please sign in to comment.