Package.json 依赖项并减少步骤生成 es5 包以进行差异加载的时间
我在这里需要一些澄清:如果您的应用程序的 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 haveimport ... from @dependencyA
.
So when I remove the dependencyA from Application package.json, the ng build fails.
It will not resolveimport ... from @commonDependency
, which has dependencyA in its package.json. Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论