【问题标题】:Resolve Warning given for CommonJS or AMD dependencies解决针对 CommonJS 或 AMD 依赖项的警告
【发布时间】:2021-09-18 08:29:57
【问题描述】:

我在终端中收到以下警告。我该如何解决这个问题? (删除警告)

Warning: C:\Users\Sharon\Documents\MyProject\PROJECTOne\node_modules\@azure\core-tracing\dist-esm\src\interfaces.js depends on '@opentelemetry/api'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

【问题讨论】:

  • 您看到消息中的更多信息链接了吗?您打开它并按照它可能提供的任何说明进行操作了吗?
  • @R.Richards 我厌倦了按照建议添加"allowedCommonJsDependencies": [ "lodash" ],但到目前为止没有任何效果
  • 为什么?为什么是lodash?上面提到 lodash 的消息中实际上没有任何内容。

标签: angularjs angular azure blob azure-blob-storage


【解决方案1】:

这是一个已知问题,旧版本的 @opentelemetry/api 不支持 ESM。 https://github.com/Azure/azure-sdk-for-js/issues/11550。一旦@azure/storage-blob 发布包含修复的新版本,该警告就会消失。

【讨论】:

    【解决方案2】:

    您可以删除 CommonJS 或 AMD 依赖项可能导致优化救助.....通过添加以下代码 sn-p 到您的 angular.json 的构建部分

    "allowedCommonJsDependencies": [
          "opentelemetry",
    
       ]
    

    如果不行就回复我

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-12-22
      • 2021-03-05
      • 1970-01-01
      • 1970-01-01
      • 2014-01-14
      • 2018-08-31
      • 2020-11-30
      • 1970-01-01
      相关资源
      最近更新 更多