From 0da19329b12c324a3fda8c6dde1e08723f147454 Mon Sep 17 00:00:00 2001 From: Matt Brictson Date: Thu, 1 Jul 2021 09:02:11 -0700 Subject: [PATCH] Fix babel "loose" warnings (#587) 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, {