带有 babel "loose" 选项警告的最新 Nuxt v2.15.7 安装
Latest Nuxt v2.15.7 install with babel "loose" option warnings
我用 npx create-nuxt-app my-cool-project
创建了一个全新的项目,但在 运行 yarn dev
.
时我确实遇到了一些错误
Though the "loose" option was set to "false" in your @babel/preset-env config, it will not be used for @babel/plugin-proposal-private-property-in-object since the "loose" mode option was set to "true" for @babel/plugin-proposal-private-methods.
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-property-in-object", { "loose": true }]
to the "plugins" section of your Babel config.
你对这个有什么想法吗?这让我想起了另一个问题:
这个问题确实回来了,如这个Github问题
所示
https://github.com/nuxt/nuxt.js/issues/9224#issuecomment-893263501
如果您的 Nuxt 版本介于 2.15.5
和 2.15.7
之间(我认为),就会发生这种情况。
一个临时解决方案可能是按照建议将其添加到您的 nuxt.config.js
文件中 here
build: {
babel: {
plugins: [
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-private-methods',
// or with JUST the line below
['@babel/plugin-proposal-private-property-in-object', { loose: true }]
],
},
}
最终修复可能很快就会发布,请随时订阅 Github 问题以获得最新更新通知。
编辑:一旦此 PR 合并并且有一个新版本,这将得到修复:https://github.com/nuxt/nuxt.js/pull/9631
至于我帮忙修改上面的答案:
yarn add --dev @babel/plugin-proposal-class-properties @babel/plugin-proposal-private-methods @babel/plugin-proposal-private-property-in-object
然后更改nuxt.config.js
:
build: {
babel:{
plugins: [
['@babel/plugin-proposal-class-properties', { loose: true }],
['@babel/plugin-proposal-private-methods', { loose: true }],
['@babel/plugin-proposal-private-property-in-object', { loose: true }]
]
}
},
我用 npx create-nuxt-app my-cool-project
创建了一个全新的项目,但在 运行 yarn dev
.
Though the "loose" option was set to "false" in your @babel/preset-env config, it will not be used for @babel/plugin-proposal-private-property-in-object since the "loose" mode option was set to "true" for @babel/plugin-proposal-private-methods. 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-property-in-object", { "loose": true }] to the "plugins" section of your Babel config.
你对这个有什么想法吗?这让我想起了另一个问题:
这个问题确实回来了,如这个Github问题
所示https://github.com/nuxt/nuxt.js/issues/9224#issuecomment-893263501
如果您的 Nuxt 版本介于 2.15.5
和 2.15.7
之间(我认为),就会发生这种情况。
一个临时解决方案可能是按照建议将其添加到您的 nuxt.config.js
文件中 here
build: {
babel: {
plugins: [
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-private-methods',
// or with JUST the line below
['@babel/plugin-proposal-private-property-in-object', { loose: true }]
],
},
}
最终修复可能很快就会发布,请随时订阅 Github 问题以获得最新更新通知。
编辑:一旦此 PR 合并并且有一个新版本,这将得到修复:https://github.com/nuxt/nuxt.js/pull/9631
至于我帮忙修改上面的答案:
yarn add --dev @babel/plugin-proposal-class-properties @babel/plugin-proposal-private-methods @babel/plugin-proposal-private-property-in-object
然后更改nuxt.config.js
:
build: {
babel:{
plugins: [
['@babel/plugin-proposal-class-properties', { loose: true }],
['@babel/plugin-proposal-private-methods', { loose: true }],
['@babel/plugin-proposal-private-property-in-object', { loose: true }]
]
}
},