Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix babel warning about private-methods #3016

Merged
merged 1 commit into from
Jun 16, 2021

Conversation

tagliala
Copy link
Contributor

@tagliala tagliala commented May 10, 2021

⚠️ I'm not a JavaScript developer ⚠️

How to replicate:

$ rails _6.1.3.2_ new test-babel-warning --skip-active-record --skip-javascript
$ cd test-babel-warning
$ echo "{ \"private\": true }" > package.json
$ echo "gem 'webpacker', '5.4.0'" >> Gemfile
$ bundle
$ bundle exec rails webpacker:install
$ echo "class Counter extends HTMLElement { #xValue = 0; }" >> app/javascript/packs/application.js
$ bin/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.

The "loose" option must be the same for:

  • @babel/plugin-proposal-class-properties,
  • @babel/plugin-proposal-private-methods
  • @babel/plugin-proposal-private-property-in-object

class-properties and private-methods are dependencies of
@babel/preset-env, which is required by webpacker.

This commit sets the same loose value for both class-properties and
private-methods to silence the warning

Fix #3008

The "loose" option must be the same for:

- @babel/plugin-proposal-class-properties,
- @babel/plugin-proposal-private-methods
- @babel/plugin-proposal-private-property-in-object

class-properties and private-methods are dependencies of
@babel/preset-env, which is required by webpacker.

This commit sets the same loose value for both class-properties and
private-methods to silence the warning 

Fix rails#3008
@tagliala tagliala force-pushed the bugfix/fix-loose-babel-warning branch from 2197e27 to 5fc3a85 Compare May 19, 2021 06:49
@tagliala
Copy link
Contributor Author

Still an issue with 5.4.0. Rebased and forced push

@dhh dhh merged commit e048d2e into rails:5-x-stable Jun 16, 2021
@tagliala tagliala deleted the bugfix/fix-loose-babel-warning branch June 16, 2021 10:42
mattbrictson added a commit to carbonfive/raygun-rails that referenced this pull request Jun 25, 2021
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:
rails/webpacker#3016
mattbrictson added a commit to carbonfive/raygun-rails that referenced this pull request Jul 1, 2021
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:
rails/webpacker#3016
duncanjbrown added a commit to DFE-Digital/apply-for-teacher-training that referenced this pull request Jul 2, 2021
duncanjbrown added a commit to DFE-Digital/apply-for-teacher-training that referenced this pull request Jul 5, 2021
duncanjbrown added a commit to DFE-Digital/apply-for-teacher-training that referenced this pull request Jul 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants