-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Closed
Labels
Has PRoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issue
Description
Isolated issue here: https://gist.github.com/anonymous/dcbc9f57057724ee5ffe0650eedc9472
git clone https://gist.github.com/dcbc9f57057724ee5ffe0650eedc9472.git example
cd example
npm install
npm run execute
npm run build
Input Code (index.js)
async function * values(iterable) {
for (const item of iterable) {
yield item;
}
}
async function collect(asyncIterator) {
const collection = [];
for await (const value of asyncIterator) {
collection.push(value);
}
return collection;
}
collect(values([5, 4, 3, 2, 1])).then(console.log, console.error);Babel Configuration (package.json)
{
"scripts": {
"build": "babel index.js --out-file build.js && node build.js",
"execute": "babel-node index.js"
},
"babel": {
"plugins": [
["transform-runtime", {"polyfill": false, "regenerator": true}]
],
"presets": ["stage-3", "latest"]
},
"dependencies": {
"babel-runtime": "^6.18.0"
},
"devDependencies": {
"babel-cli": "^6.18.0",
"babel-plugin-transform-runtime": "^6.15.0",
"babel-preset-latest": "^6.16.0",
"babel-preset-stage-3": "^6.17.0"
}
}Expected Behavior
Both scripts in package.json:scripts should log the array [5, 4, 3, 2, 1].
Current Behavior
The build script that relies on babel command produces a build file that throws:
TypeError: Object is not async iterable
On the other hand, the execute script relying on babel-node works properly.
Possible Solution
The fact that babel-node works might be a clue.
Also @hzoo on slack mentioned it might be related to #4768.
Your Environment
Module versions are specified in package.json above.
| software | version |
|---|---|
| node | 6.7.0 |
| npm | 3.10.9 |
| Operating System | Win 10 |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Has PRoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issue