💻
How are you using Babel?
Other (Next.js, Gatsby, vue-cli, ...)
Input code
var [ ] = { [ Symbol . iterator ] : ( ) => [ ] } ;
Configuration file name
No response
Configuration
No response
Current and expected behavior
In input.js, Symbol.iterator is lazily evaluated so input.js is terminated without error.
On the other hand, Array.from(iter) in output.js eagerly throws TypeError:
$ node input.js # no error
$ node output.js
output.js:48
return Array.from(iter);
^
TypeError: undefined is not a function
at Function.from (<anonymous>)
at _iterableToArray (output.js:48:18)
at _toArray (output.js:17:5)
at Object.<anonymous> (output.js:56:23)
at Module._compile (node:internal/modules/cjs/loader:1159:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
at Module.load (node:internal/modules/cjs/loader:1037:32)
at Module._load (node:internal/modules/cjs/loader:878:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47
Node.js v18.11.0
Environment
Reproduction on Babel's own REPL
Possible solution
No response
Additional context
No response
💻
How are you using Babel?
Other (Next.js, Gatsby, vue-cli, ...)
Input code
Configuration file name
No response
Configuration
No response
Current and expected behavior
In
input.js,Symbol.iteratoris lazily evaluated soinput.jsis terminated without error.On the other hand,
Array.from(iter)inoutput.jseagerly throwsTypeError:Environment
Reproduction on Babel's own REPL
Possible solution
No response
Additional context
No response