添加 ngx-daterangepicker 时无法构建
cannot build when ngx-daterangepicker added
当我将 ngx 日期范围选择器模块添加到我的 angular 项目时,无法构建它。它因错误而失败:
ERROR in ./node_modules/ngx-daterangepicker-material/fesm5/ngx-daterangepicker-material.js
Module build failed (from ./node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js):
TypeError: Cannot read property 'kind' of undefined
有人知道是什么问题吗??
https://stackblitz.com/edit/angular-ngx-daterangepicker-material-build-problem
这在使用 ng serve
时有效,但是
我使用 ng build --prod
构建了整个 angular 应用程序,问题如下
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
并且由于 stackblitz 导出不包含环境目录,您应该通过添加此类文件或在 angular.json
上评论此行来解决问题
第二个问题是针对 stackblitz 提供的旧版本 angular 依赖项,因此我在 packages.json
上将它们更新为 ng new myApp
生成的内容。
"@angular/animations": "~9.0.1",
"@angular/common": "~9.0.1",
"@angular/compiler": "~9.0.1",
"@angular/core": "~9.0.1",
"@angular/forms": "~9.0.1",
"@angular/platform-browser": "~9.0.1",
"@angular/platform-browser-dynamic": "~9.0.1",
"@angular/router": "~9.0.1",
"@angular-devkit/build-angular": "~0.900.2",
"@angular/cli": "~9.0.2",
"@angular/compiler-cli": "~9.0.1",
"@angular/language-service": "~9.0.1",
"typescript": "~3.7.5"
最终它使用 ng build --prod
成功构建
终于找到答案了...这个问题是新版本的ngx-daterangepicker发布的。当我使用较低版本时,我可以毫无问题地构建。感谢您的支持。
版本 -
"ngx-daterangepicker-material": "~2.0.2"
解决了我通过升级到
解决的一个非常相似的问题
"@angular-devkit/build-angular": "^0.803.23",
当我将 ngx 日期范围选择器模块添加到我的 angular 项目时,无法构建它。它因错误而失败:
ERROR in ./node_modules/ngx-daterangepicker-material/fesm5/ngx-daterangepicker-material.js Module build failed (from ./node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js): TypeError: Cannot read property 'kind' of undefined
有人知道是什么问题吗??
https://stackblitz.com/edit/angular-ngx-daterangepicker-material-build-problem
这在使用 ng serve
时有效,但是
我使用 ng build --prod
构建了整个 angular 应用程序,问题如下
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
并且由于 stackblitz 导出不包含环境目录,您应该通过添加此类文件或在 angular.json
第二个问题是针对 stackblitz 提供的旧版本 angular 依赖项,因此我在 packages.json
上将它们更新为 ng new myApp
生成的内容。
"@angular/animations": "~9.0.1",
"@angular/common": "~9.0.1",
"@angular/compiler": "~9.0.1",
"@angular/core": "~9.0.1",
"@angular/forms": "~9.0.1",
"@angular/platform-browser": "~9.0.1",
"@angular/platform-browser-dynamic": "~9.0.1",
"@angular/router": "~9.0.1",
"@angular-devkit/build-angular": "~0.900.2",
"@angular/cli": "~9.0.2",
"@angular/compiler-cli": "~9.0.1",
"@angular/language-service": "~9.0.1",
"typescript": "~3.7.5"
最终它使用 ng build --prod
终于找到答案了...这个问题是新版本的ngx-daterangepicker发布的。当我使用较低版本时,我可以毫无问题地构建。感谢您的支持。
版本 -
"ngx-daterangepicker-material": "~2.0.2"
解决了我通过升级到
解决的一个非常相似的问题"@angular-devkit/build-angular": "^0.803.23",