将 webpacker 与 Rails 一起使用,编译过程会收到来自 babel 的更改配置问题的垃圾邮件
虽然向文件添加分辨率块的解决方案package.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.
Run Code Online (Sandbox Code Playgroud)
没那么有帮助。搜索config显示 76 个项目,其中 2 个具有该名称的目录和 4 个.js名称中包含该字符串的字段。在 babel 子目录中plugin-proposal-class-properties没有配置文件,并且建议的字符串不是 json 格式,因此不会进入该 su 目录的package.json文件
那么我们具体在哪里设置呢?
在数组babel.config.js内plugins,只需将其添加为最后一项:
['@babel/plugin-proposal-private-methods', { loose: true }]
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
578 次 |
| 最近记录: |