Skip to content

Commit

Permalink
fix: do not use externalHelpers
Browse files Browse the repository at this point in the history
  • Loading branch information
fi3ework committed May 1, 2020
1 parent ac71051 commit 9e187dd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
9 changes: 1 addition & 8 deletions src/babel/preset.ts
Expand Up @@ -48,14 +48,7 @@ export default (
objectAssign
}
],
asyncToPromises && [
// Not documented in README. But it helps to reduce helper function.
// https://github.com/rpetrich/babel-plugin-transform-async-to-promises/pull/57/files#diff-04c6e90faac2675aa89e2176d2eec7d8
require('babel-plugin-transform-async-to-promises'),
{
externalHelpers: true
}
]
asyncToPromises && require('babel-plugin-transform-async-to-promises')
].filter(Boolean)

return {
Expand Down
16 changes: 14 additions & 2 deletions test/__snapshots__/index.test.ts.snap
Expand Up @@ -39,12 +39,24 @@ exports.s = s;
exports[`async: async dist/index.js 1`] = `
"'use strict';
var helpers = require('babel-plugin-transform-async-to-promises/helpers');
function _async(f) {
return function () {
for (var args = [], i = 0; i < arguments.length; i++) {
args[i] = arguments[i];
}
try {
return Promise.resolve(f.apply(this, args));
} catch (e) {
return Promise.reject(e);
}
};
}
const a = {
a: 1
};
var index = helpers._async(function () {
var index = _async(function () {
return Object.assign({}, a, {
b
});
Expand Down

0 comments on commit 9e187dd

Please sign in to comment.