From d906098916cdc61002e736da842d945d2dbfcd61 Mon Sep 17 00:00:00 2001 From: Matt Brictson Date: Fri, 25 Jun 2021 16:05:09 -0700 Subject: [PATCH] Fix babel "loose" warnings This fixes the following warnings emitted by webpack: ``` Though the "loose" option was set to "false" in your @babel/preset-env config, it will not be used for @babel/plugin-proposal-private-methods since the "loose" mode option was set to "true" for @babel/plugin-proposal-class-properties. 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-methods", { "loose": true }] to the "plugins" section of your Babel config. ``` This matches the new default babel config generated by webpacker: https://github.com/rails/webpacker/pull/3016 --- babel.config.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/babel.config.js b/babel.config.js index 84888b61..d3ac0fd9 100644 --- a/babel.config.js +++ b/babel.config.js @@ -47,6 +47,12 @@ module.exports = function(api) { loose: true } ], + [ + require('@babel/plugin-proposal-private-methods').default, + { + loose: true + } + ], [ require('@babel/plugin-proposal-object-rest-spread').default, {