From 69a03c8b071bc1c9e5161e8bd273fbc73bf8d3b2 Mon Sep 17 00:00:00 2001 From: Daniel Uber Date: Wed, 23 Jun 2021 13:57:51 -0500 Subject: [PATCH] Add explicit loose configuration for babel plugins (#14048) * Add explicit loose configuration for babel private-property plugin Squelch this warning that happens a few dozen times during CI by following the instructions: Though the "loose" option was set to "false" in your @babel/preset-env config, it will not be used for @babel/plugin-proposal-private-property-in-object since the "loose" mode option was set to "true" for @babel/plugin-proposal-private-methods. The "loose" option must be the same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods and @babel/plugin-proposal-private-property-in-object (when they are enabled): you can silence this warning by explicitly adding ["@babel/plugin-proposal-private-property-in-object", { "loose": true }] to the "plugins" section of your Babel config. * Use spaces instead of tabs This won't affect the test. * Make all the other "implied loose" options loose, too. This now squelches the warnings, and webpacker can compile without failing. * Collect common option "loose: true" to preset env Rather than 3 overrides to bring these inline, move to the shared options. * Revert "Collect common option "loose: true" to preset env" This reverts commit ca3d09ba6a47e03dbfb5f6108fcbc7f19b5a457b. --- babel.config.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/babel.config.js b/babel.config.js index c90815dda..652dd7f97 100644 --- a/babel.config.js +++ b/babel.config.js @@ -42,6 +42,7 @@ module.exports = function (api) { '@babel/plugin-proposal-class-properties', { spec: true, + loose: true, }, ], [ @@ -50,6 +51,18 @@ module.exports = function (api) { useBuiltIns: true, }, ], + [ + '@babel/plugin-proposal-private-property-in-object', + { + loose: true, + } + ], + [ + '@babel/plugin-proposal-private-methods', + { + loose: true, + } + ], [ '@babel/plugin-transform-react-jsx', {