-
Notifications
You must be signed in to change notification settings - Fork 361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
async/await is always transpiled into regenerator even with browserconfig or babelrc #705
Comments
#!/bin/bash
cat > index.js <<< 'export function* yo() { yield 1 }'
cat > package.json <<< '{"name":"a","devDependencies":{"microbundle":"0.12.3"}}'
cat > .babelrc <<'EOF'
{
"presets": [
[
"@babel/preset-env",
{
"exclude": ["transform-regenerator"]
}
]
]
}
EOF
yarn
yarn microbundle --no-compress
cat dist/a.js |
Current workaround: patch microbundle. Below example shows how to patch microbundle without hassle using Yarn 2. diff --git a/dist/cli.js b/dist/cli.js
index 5672733813ad0999e4f12d05d751951bc9a472a5..dd92b95369baa5fb67cfb019544dbbce14a450a1 100644
--- a/dist/cli.js
+++ b/dist/cli.js
@@ -237,9 +237,6 @@ var customBabel = (() => {
}, {
name: '@babel/plugin-proposal-class-properties',
loose: true
- }, !customOptions.modern && {
- name: '@babel/plugin-transform-regenerator',
- async: false
}, {
name: 'babel-plugin-macros'
}].filter(Boolean));
diff --git a/dist/microbundle.js b/dist/microbundle.js
index 91fd66a0e8da2f8e961c0f6fd43f00a926f0fc45..7b6bc7cb53688b5660156b1cd8b5ba65020b3bdf 100644
--- a/dist/microbundle.js
+++ b/dist/microbundle.js
@@ -236,9 +236,6 @@ var customBabel = (() => {
}, {
name: '@babel/plugin-proposal-class-properties',
loose: true
- }, !customOptions.modern && {
- name: '@babel/plugin-transform-regenerator',
- async: false
}, {
name: 'babel-plugin-macros'
}].filter(Boolean)); {
"devDependencies": {
"microbundle": "patch:[email protected]#./microbundle.patch"
}
} |
Just to clarify: this only happens when running We don't use |
Actually it didn’t worked for the browser target too. I |
@simnalamburt the two changes in #707 should still fix this, including for the browser target. The issue was that we had regenerator manually turned on because it isn't handled by the async-to-promises. |
@developit Hi, was the proposed fix for this, #707 , ever released? I'm running into the same issue (specifically, my .babelrc file being ignored when targeting node) and I can't find it in any releases, though I may have overlooked it. Thanks for supporting this project, loving it so far! |
The fix should be shipped - the only issue was that we forcibly transpile async to promises for Node. |
I've updated the title to clarify issue more clearly! |
Click to see workaround
How to reproduce error
Execute this script in an empty directory
Expected resut
Actual result
The text was updated successfully, but these errors were encountered: