我正在运行sls部署并收到以下警告,其中会发送许多行垃圾邮件。
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
...
此警告的原因是什么,我应该担心吗?我该如何解决?
(如果我需要为此问题添加额外信息,请告诉我,我会立即编辑问题(。
以下情况下遇到了同样的问题:
无服务器 + Webpack + Babel
在推荐的 webpack 配置中,排除了开发依赖项。Babel-runtime(依赖于 babel,通常作为 dev-依赖项添加(也是一个开发依赖项。
如果你将 babel-runtime 添加到你的常见依赖项中,现在无服务器(使用 webpack(将打包 babel-runtime 中有关包的完整信息(在本例中为所需的版本(。
yarn add babel-runtime
或
npm i babel-runtime
您可以避免这些警告。
如果警告没有导致问题,我总是后悔尝试修复 npm,因为您总是最终会浪费时间冲突的版本和破碎的无服务器部署。