Skip to content

ES7 async/await support #341

@kennu

Description

@kennu

Hi. I added async/await support to my Gatsby project by adding this to gatsby-node.js:

exports.modifyWebpackConfig = function(config, env) {
  if (env === 'build-javascript' || env === 'develop') {
    const previous = config.resolve().entry
    config._config.entry = []
    config.merge({
      entry: ['babel-polyfill'].concat(previous)
    })
  }
  return config
}

And by installing the polyfill package:

npm install --save babel-polyfill

I guess this could be some kind of default in Gatsby to avoid manually messing with the entry array order.

(Tweeted about it as @kfalck, I'm also @kennu on Twitter.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions