【问题标题】:webpacker babel spam removal message not clear enoughwebpacker babel 垃圾邮件清除消息不够清晰
【发布时间】:2021-05-31 08:23:52
【问题描述】:

将 webpacker 与 rails 结合使用,编译过程中会出现 babel 更改配置问题表单的垃圾邮件

虽然this solution of adding a resolutions blockpackage.json 文件,+ 对最新版本的更新,删除了这些消息的一部分,但仍有一些

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.

没那么有用。搜索 config 会显示 76 个项目,其中 2 个具有该名称的目录和 4 个名称中包含该字符串的 .js 字段。在 babel 子目录 plugin-proposal-class-properties 中没有配置文件,并且建议的字符串不是 json 格式,因此不会进入该 su 目录的 package.json 文件

那么我们到底在哪里设置呢?

【问题讨论】:

    标签: babeljs webpacker


    【解决方案1】:

    babel.config.js 中,在plugins 数组中,将其添加为最后一项:

    ['@babel/plugin-proposal-private-methods', { loose: true }]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-14
      • 1970-01-01
      • 2019-05-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多