FredKSchott / pika-pack-builders

🏗 A collection of official & community @pika/pack build plugins
MIT License
162 stars 31 forks source link

for await in plugin-standard-pkg #99

Open dy opened 4 years ago

dy commented 4 years ago

Getting the following error in attempt to build pika:

[3/9] Running @pika/plugin-standard-pkg...
SyntaxError: C:\projects\spect\src\any.js: Unexpected token, expected "(" (15:8)

  13 |
  14 |   args.forEach(input => {
> 15 |     for await (const value of input) {
     |         ^
  16 |
  17 |     }
  18 |   })

Is there any way to work that around?

dy commented 4 years ago

Adding .babelrc:

{
  "plugins": [
    "@babel/plugin-syntax-async-generators",
    "@babel/plugin-proposal-async-generator-functions"
  ]
}

doesn't help. It seems to ignore .babelrc at all.

FredKSchott commented 4 years ago

Hmm, you definitely should be able to use it via your own custom babelrc, like in the example above.

We wouldn't support this in @pika/plugin-standard-pkg directly, since this is still proposed syntax and hasn't yet been added to the language spec (see https://tc39.es/proposal-async-iteration/)

I actually can reproduce this but even when running babel.loadOptions() directly in a directory with a .babelrc file. I was able to fix this by renaming my .babelrc to babel.config.json. Try that and let me know if that works.

Has .babelrc been deprecated in favor of the newer babel.config.json? If so, we can add a warning message to help.