Skip to content

Commit

Permalink
feat(gatsby): support ?. and ?? in generated pages
Browse files Browse the repository at this point in the history
Basically tested with an empty repo in dev mode, added `console.log(SEO?.foo ?? 'bar')` before and after this change. Before it would crash on the new syntax and afterwards it would work. Both `develop` and `build`.
  • Loading branch information
pvdz committed Dec 10, 2019
1 parent a9e4046 commit b4d4669
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/babel-preset-gatsby/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
"homepage": "https://github.com/gatsbyjs/gatsby/tree/master/packages/babel-preset-gatsby#readme",
"dependencies": {
"@babel/plugin-proposal-class-properties": "^7.7.4",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.7.4",
"@babel/plugin-proposal-optional-chaining": "^7.7.5",
"@babel/plugin-syntax-dynamic-import": "^7.7.4",
"@babel/plugin-transform-runtime": "^7.7.6",
"@babel/plugin-transform-spread": "^7.7.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ Object {
"loose": true,
},
],
Array [
"<PROJECT_ROOT>/node_modules/@babel/plugin-proposal-nullish-coalescing-operator/lib/index.js",
],
Array [
"<PROJECT_ROOT>/node_modules/@babel/plugin-proposal-optional-chaining/lib/index.js",
],
"<PROJECT_ROOT>/node_modules/babel-plugin-macros/dist/index.js",
"<PROJECT_ROOT>/node_modules/@babel/plugin-syntax-dynamic-import/lib/index.js",
Array [
Expand Down Expand Up @@ -66,6 +72,12 @@ Object {
"loose": true,
},
],
Array [
"<PROJECT_ROOT>/node_modules/@babel/plugin-proposal-nullish-coalescing-operator/lib/index.js",
],
Array [
"<PROJECT_ROOT>/node_modules/@babel/plugin-proposal-optional-chaining/lib/index.js",
],
"<PROJECT_ROOT>/node_modules/babel-plugin-macros/dist/index.js",
"<PROJECT_ROOT>/node_modules/@babel/plugin-syntax-dynamic-import/lib/index.js",
Array [
Expand Down Expand Up @@ -127,6 +139,12 @@ Object {
"loose": true,
},
],
Array [
"<PROJECT_ROOT>/node_modules/@babel/plugin-proposal-nullish-coalescing-operator/lib/index.js",
],
Array [
"<PROJECT_ROOT>/node_modules/@babel/plugin-proposal-optional-chaining/lib/index.js",
],
"<PROJECT_ROOT>/node_modules/babel-plugin-macros/dist/index.js",
"<PROJECT_ROOT>/node_modules/@babel/plugin-syntax-dynamic-import/lib/index.js",
Array [
Expand Down Expand Up @@ -182,6 +200,12 @@ Object {
"loose": true,
},
],
Array [
"<PROJECT_ROOT>/node_modules/@babel/plugin-proposal-nullish-coalescing-operator/lib/index.js",
],
Array [
"<PROJECT_ROOT>/node_modules/@babel/plugin-proposal-optional-chaining/lib/index.js",
],
"<PROJECT_ROOT>/node_modules/babel-plugin-macros/dist/index.js",
"<PROJECT_ROOT>/node_modules/@babel/plugin-syntax-dynamic-import/lib/index.js",
Array [
Expand Down
2 changes: 2 additions & 0 deletions packages/babel-preset-gatsby/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ module.exports = function preset(_, options = {}) {
loose: true,
},
],
[resolve(`@babel/plugin-proposal-nullish-coalescing-operator`)],
[resolve(`@babel/plugin-proposal-optional-chaining`)],
resolve(`babel-plugin-macros`),
resolve(`@babel/plugin-syntax-dynamic-import`),
[
Expand Down

0 comments on commit b4d4669

Please sign in to comment.