php - symfony/encore @babel/preset-env 设置 corejs 的正确方法
问题描述
@babel/preset-env
更新到版本后7.4.2
出现错误:
WARNING: We noticed you're using the `useBuiltIns` option without declaring a core-js version. Currently, we assume version 2.x when no version is passed. Since this default version will likely change in future versions of Babel, we recommend explicitly setting the core-js version you are using via the `corejs` option.
You should also be sure that the version you pass to the `corejs` option matches the version specified in your `package.json`'s `dependencies` section. If it doesn't, you need to run one of the following commands:
npm install --save core-js@2 npm install --save core-js@3
yarn add core-js@2 yarn add core-js@3
我发现的唯一可行的解决方案是在我的weback.config.js
Encore.configureBabel(function(babelConfig) {
babelConfig.presets[0][1].corejs = 2;
}, {});
但我不喜欢设置[0][1]
为预设环境数组添加新属性。也许有更多建议如何以正确的方式做?
解决方案
推荐阅读
- javascript - 多个createObjectURL时加载资源err_file_not_found失败
- syntax - 使用 jq 删除重复项
- appium - Appium 桌面未在 MAC 中启动 Appium Inspector UI
- testing - 使用 cypress 在第一次尝试时失败,但在第二次尝试时总是通过而不重试
- python - 比较两个文件并将新列添加到文件一,如果为真
- c# - 用于后端应用程序的 MSAL.net 或 Graph SDK
- c# - 用于请求/响应机制的 MassTransit 自定义查询/命令拓扑
- flutter - 如何使用 getx 库 Flutter 中的 GetConnect 在 http 请求中使用 SSL Pining 证书
- class - 导入类函数变量
- python - 如何仅重新排列 Pyspark Dataframe 的某些列而不列出所有列名?