Skip to content

Commit

Permalink
feat(gatsby): support nullish coalescing operator in gatsby (#20010)
Browse files Browse the repository at this point in the history
* feat(gatsby): support nullish coalescing operator in gatsby

This means we can do `a ?? b` in node now (this should not affect output of, say, webpack).

Note that the `??` operator (together with the `?.` operator, which we already added earlier) have been accepted to be added to the JS spec. For all intentions and purposes; that means it's now part of JS.

* yarn jest -u
  • Loading branch information
pvdz authored and GatsbyJS Bot committed Dec 9, 2019
1 parent 9227977 commit a898a77
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
Expand Up @@ -61,6 +61,7 @@ Array [
exports[`babel-preset-gatsby-package in browser mode specifies the proper plugins 1`] = `
Array [
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-nullish-coalescing-operator",
"@babel/plugin-proposal-optional-chaining",
"@babel/plugin-transform-runtime",
"@babel/plugin-syntax-dynamic-import",
Expand Down Expand Up @@ -123,6 +124,7 @@ Array [
exports[`babel-preset-gatsby-package in node mode specifies the proper plugins 1`] = `
Array [
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-nullish-coalescing-operator",
"@babel/plugin-proposal-optional-chaining",
"@babel/plugin-transform-runtime",
"@babel/plugin-syntax-dynamic-import",
Expand Down
1 change: 1 addition & 0 deletions packages/babel-preset-gatsby-package/index.js
Expand Up @@ -43,6 +43,7 @@ function preset(context, options = {}) {
],
plugins: [
r(`@babel/plugin-proposal-class-properties`),
r(`@babel/plugin-proposal-nullish-coalescing-operator`),
r(`@babel/plugin-proposal-optional-chaining`),
r(`@babel/plugin-transform-runtime`),
r(`@babel/plugin-syntax-dynamic-import`),
Expand Down
1 change: 1 addition & 0 deletions packages/babel-preset-gatsby-package/package.json
Expand Up @@ -10,6 +10,7 @@
"homepage": "https://github.com/gatsbyjs/gatsby/tree/master/packages/babel-preset-gatsby-package#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.4",
"@babel/plugin-syntax-dynamic-import": "^7.7.4",
"@babel/plugin-transform-runtime": "^7.7.4",
Expand Down

0 comments on commit a898a77

Please sign in to comment.