Package.json 依赖项并减少步骤生成 es5 包以进行差异加载的时间

发布于 2025-01-10 07:00:20 字数 1762 浏览 0 评论 0原文

我在这里需要一些澄清:如果您的应用程序的 package.json 有 dependencyA 和另一个 commonDependency,并且 commonDependency 的 package.json 已经有 dependencyA,那么您的应用程序的 package.json 中需要 dependencyA 吗?我的猜测是否定的,但我需要确认。

我正在尝试减少这一步所需的时间(目前在我们的 Jenkins 服务器上约为 60 分钟):生成用于差异加载的 es5 包...

我相信通过从我们的应用程序中删除一些“对等/嵌套”依赖项,构建时间将会改善。

应用程序包 JSON

"dependencies": {
   "@dependencyA": "1.2.3", <-- is this required here?
   "@commonDependency": "2.3.4"
}

CommonDependency Package JSON

"dependencies": {
   "@dependencyA": "1.2.3",
   "@dependencyB": "4.5.6",
   "@dependencyC": "7.8.9",
}

应用程序 TSConfig JSON

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "paths": {
      "@angular/*": [
        "./node_modules/@angular/*"
      ]
    },
    "module": "es2020",
    "moduleResolution": "node",
    "importHelpers": true,
    "experimentalDecorators": true,
    "skipLibCheck": true,
    "target": "es2015",
    "preserveSymlinks": true,
    "downlevelIteration": true,
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2018",
      "dom",
      "esnext.asynciterable"
    ]
  },
  "angularCompilerOptions": {
    "fullTemplateTypeCheck": true,
    "strictInjectionParameters": true
  }
}

更新: 我现在的问题是这样的: 在应用程序中,有 .ts 文件,其中包含 从@dependencyA导入...

因此,当我从应用程序 package.json 中删除 dependencyA 时,ng 构建失败。

不会解决 import ... from @commonDependency,它的 package.json 中有 dependencyA。有什么建议吗?

I need some clarification here: If your application's package.json has dependencyA and another commonDependency, and commonDependency's package.json already has dependencyA, does your application need dependencyA in its package.json? My guess is no, but I need to confirm.

I am trying to reduce the time (currently ~60 mins on our Jenkins server) it takes for this step: Generating es5 bundles for differential loading...

I believe by removing some of these "peer/nested" dependencies from our application, the build times will improve.

Application Package JSON

"dependencies": {
   "@dependencyA": "1.2.3", <-- is this required here?
   "@commonDependency": "2.3.4"
}

CommonDependency Package JSON

"dependencies": {
   "@dependencyA": "1.2.3",
   "@dependencyB": "4.5.6",
   "@dependencyC": "7.8.9",
}

Application TSConfig JSON

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "paths": {
      "@angular/*": [
        "./node_modules/@angular/*"
      ]
    },
    "module": "es2020",
    "moduleResolution": "node",
    "importHelpers": true,
    "experimentalDecorators": true,
    "skipLibCheck": true,
    "target": "es2015",
    "preserveSymlinks": true,
    "downlevelIteration": true,
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2018",
      "dom",
      "esnext.asynciterable"
    ]
  },
  "angularCompilerOptions": {
    "fullTemplateTypeCheck": true,
    "strictInjectionParameters": true
  }
}

UPDATE:
My issue now is this:
In the Application, there are .ts files that have
import ... from @dependencyA.

So when I remove the dependencyA from Application package.json, the ng build fails.

It will not resolve
import ... from @commonDependency, which has dependencyA in its package.json. Any suggestions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文