From 8d74a32f060e1c0fe7a9ef5f816a0d099c52a4fa Mon Sep 17 00:00:00 2001 From: Caleb Date: Wed, 14 Feb 2018 12:49:47 -0700 Subject: [PATCH] Fix build for Gatsby (WebPack v1). WebPack version 1, which Gatsby is using, has the Acorn parser set to parse ES6 and lower. The latest version of WebPack supports parsing up to ES2017 and lower (webpack/lib/Parser.js), but Gatsby isn't using it. --- .babelrc | 7 ++++++- package.json | 2 ++ yarn.lock | 17 +++++++++++++++-- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/.babelrc b/.babelrc index 8b37840c11ec..206abea274f2 100644 --- a/.babelrc +++ b/.babelrc @@ -14,7 +14,12 @@ ] } }], - "react" + "react", + /** + * Support WebPack version 1. + */ + "es2016", + "es2017", ], "plugins": [ "lodash", diff --git a/package.json b/package.json index 28664bebd7a9..4869f3a42cb8 100644 --- a/package.json +++ b/package.json @@ -85,6 +85,8 @@ "babel-plugin-transform-object-rest-spread": "^6.26.0", "babel-plugin-transform-runtime": "^6.23.0", "babel-preset-env": "^1.6.0", + "babel-preset-es2016": "^6.24.1", + "babel-preset-es2017": "^6.24.1", "babel-preset-react": "^6.23.0", "babel-runtime": "^6.23.0", "cross-env": "^5.0.2", diff --git a/yarn.lock b/yarn.lock index 9ff3d90c77db..70bc67160e05 100644 --- a/yarn.lock +++ b/yarn.lock @@ -638,7 +638,7 @@ babel-plugin-syntax-trailing-function-commas@^6.22.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz#ba0360937f8d06e40180a43fe0d5616fff532cf3" -babel-plugin-transform-async-to-generator@^6.22.0: +babel-plugin-transform-async-to-generator@^6.22.0, babel-plugin-transform-async-to-generator@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-async-to-generator/-/babel-plugin-transform-async-to-generator-6.24.1.tgz#6536e378aff6cb1d5517ac0e40eb3e9fc8d08761" dependencies: @@ -830,7 +830,7 @@ babel-plugin-transform-es2015-unicode-regex@^6.22.0: babel-runtime "^6.22.0" regexpu-core "^2.0.0" -babel-plugin-transform-exponentiation-operator@^6.22.0: +babel-plugin-transform-exponentiation-operator@^6.22.0, babel-plugin-transform-exponentiation-operator@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-exponentiation-operator/-/babel-plugin-transform-exponentiation-operator-6.24.1.tgz#2ab0c9c7f3098fa48907772bb813fe41e8de3a0e" dependencies: @@ -949,6 +949,19 @@ babel-preset-env@^1.6.0: invariant "^2.2.2" semver "^5.3.0" +babel-preset-es2016@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-preset-es2016/-/babel-preset-es2016-6.24.1.tgz#f900bf93e2ebc0d276df9b8ab59724ebfd959f8b" + dependencies: + babel-plugin-transform-exponentiation-operator "^6.24.1" + +babel-preset-es2017@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-preset-es2017/-/babel-preset-es2017-6.24.1.tgz#597beadfb9f7f208bcfd8a12e9b2b29b8b2f14d1" + dependencies: + babel-plugin-syntax-trailing-function-commas "^6.22.0" + babel-plugin-transform-async-to-generator "^6.24.1" + babel-preset-flow@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-preset-flow/-/babel-preset-flow-6.23.0.tgz#e71218887085ae9a24b5be4169affb599816c49d"