From 3aa3a28a07c81049279baeb1e31339a366d8c257 Mon Sep 17 00:00:00 2001 From: sienori Date: Wed, 2 Mar 2022 21:35:55 +0900 Subject: [PATCH] Enable .? and ?? operator with Babel --- babel.config.js | 2 +- package-lock.json | 52 +++++++++++++++++++++++++++++++++++++++++++++++ package.json | 2 ++ 3 files changed, 55 insertions(+), 1 deletion(-) diff --git a/babel.config.js b/babel.config.js index 1044340..21254eb 100644 --- a/babel.config.js +++ b/babel.config.js @@ -10,5 +10,5 @@ module.exports = { ], "@babel/preset-react" ], - plugins: ["@babel/plugin-proposal-object-rest-spread", "transform-class-properties"] + plugins: ["@babel/plugin-proposal-nullish-coalescing-operator", "@babel/plugin-syntax-optional-chaining", "@babel/plugin-proposal-object-rest-spread", "transform-class-properties"] }; diff --git a/package-lock.json b/package-lock.json index 52451f1..c66fa61 100644 --- a/package-lock.json +++ b/package-lock.json @@ -324,6 +324,24 @@ "@babel/plugin-syntax-json-strings": "^7.0.0" } }, + "@babel/plugin-proposal-nullish-coalescing-operator": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.16.7.tgz", + "integrity": "sha512-aUOrYU3EVtjf62jQrCj63pYZ7k6vns2h/DQvHPWGmsJRYzWXZ6/AsfgpiRy6XiuIDADhJzP2Q9MwSMKauBQ+UQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3" + }, + "dependencies": { + "@babel/helper-plugin-utils": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.16.7.tgz", + "integrity": "sha512-Qg3Nk7ZxpgMrsox6HreY1ZNKdBq7K72tDSliA6dCl5f007jR4ne8iD5UzuNnCJH2xBf2BEEVGr+/OL6Gdp7RxA==", + "dev": true + } + } + }, "@babel/plugin-proposal-object-rest-spread": { "version": "7.9.6", "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.9.6.tgz", @@ -436,6 +454,23 @@ "@babel/helper-plugin-utils": "^7.0.0" } }, + "@babel/plugin-syntax-nullish-coalescing-operator": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", + "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "dependencies": { + "@babel/helper-plugin-utils": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.16.7.tgz", + "integrity": "sha512-Qg3Nk7ZxpgMrsox6HreY1ZNKdBq7K72tDSliA6dCl5f007jR4ne8iD5UzuNnCJH2xBf2BEEVGr+/OL6Gdp7RxA==", + "dev": true + } + } + }, "@babel/plugin-syntax-object-rest-spread": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.0.0.tgz", @@ -454,6 +489,23 @@ "@babel/helper-plugin-utils": "^7.0.0" } }, + "@babel/plugin-syntax-optional-chaining": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", + "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "dependencies": { + "@babel/helper-plugin-utils": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.16.7.tgz", + "integrity": "sha512-Qg3Nk7ZxpgMrsox6HreY1ZNKdBq7K72tDSliA6dCl5f007jR4ne8iD5UzuNnCJH2xBf2BEEVGr+/OL6Gdp7RxA==", + "dev": true + } + } + }, "@babel/plugin-transform-arrow-functions": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.0.0.tgz", diff --git a/package.json b/package.json index 71bcf94..8b16d11 100644 --- a/package.json +++ b/package.json @@ -14,8 +14,10 @@ }, "devDependencies": { "@babel/core": "^7.0.0-beta.49", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.7", "@babel/plugin-proposal-object-rest-spread": "^7.9.6", "@babel/plugin-syntax-jsx": "^7.2.0", + "@babel/plugin-syntax-optional-chaining": "^7.8.3", "@babel/preset-env": "^7.0.0-beta.49", "@babel/preset-react": "^7.0.0-beta.49", "babel-loader": "^8.0.0-beta.3",