无服务器警告:无法确定模块 babel-runtime 的版本 [英] Serverless WARNING: Could not determine version of module babel-runtime

查看:64
本文介绍了无服务器警告:无法确定模块 babel-runtime 的版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行 sls deploy 并收到以下警告,该警告发送了很多行.

I'm running sls deploy and getting the following warning that spams many lines.

Serverless: WARNING: Could not determine version of module babel-runtime
Serverless: WARNING: Could not determine version of module babel-runtime
Serverless: WARNING: Could not determine version of module babel-runtime
Serverless: WARNING: Could not determine version of module babel-runtime
Serverless: WARNING: Could not determine version of module babel-runtime
...

这个警告的原因是什么,我应该担心吗?我该如何解决?

What is the cause of this warning, should I be concerned? How do I fix it?

(如果我需要为此问题添加额外信息,请告诉我,我会立即编辑问题).

(If I need to add extra information to this question, please let me know and I'll edit the question right away).

推荐答案

我在以下场景中遇到了同样的问题:

I'm having the same issue in the following scenario:

无服务器 + Webpack + Babel

Serverless + Webpack + Babel

在推荐的 webpack 配置中,dev-dependencies 被排除在外.Babel-runtime(依赖于 babel,通常作为 dev-dependency 添加)也是一个 dev-dependency.

In recommended webpack config, dev-dependencies are excluded. Babel-runtime (depends of babel, normally added as dev-dependency) is a dev-dependency too.

如果您将 babel-runtime 添加到您的公共依赖项中,现在无服务器(使用 webpack)将打包 babel-runtime 以及有关该包的完整信息(在这种情况下,需要的版本).

If you add babel-runtime to your common dependecies, now serverless (using webpack) will package babel-runtime with full information about the package (in this case, the version required).

yarn add babel-runtime

npm i babel-runtime

您可以避免这些警告.

这篇关于无服务器警告:无法确定模块 babel-runtime 的版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆