Я создаю пользовательскую библиотеку Angular 7 с некоторыми директивами, каналами и поставщиками, общими для всех проектов компании;Тем не менее, я сталкиваюсь с этой странной проблемой при использовании модуля, который я создал, в другом проекте:
h2r-shared-base.js?9483:1023 Uncaught TypeError: Cannot read property 'Directive' of undefined
at eval (h2r-shared-base.js?9483:1023)
at eval (h2r-shared-base.js?9483:1047)
at createCommonjsModule (h2r-shared-base.js?9483:18)
at eval (h2r-shared-base.js?9483:724)
at Object../node_modules/@h2r/shared-base/fesm5/h2r-shared-base.js (main.bundle.js:955)
at __webpack_require__ (main.bundle.js:712)
at fn (main.bundle.js:95)
at eval (user.service.ts?cada:7)
at Object../src/main/webapp/app/shared/user/user.service.ts (main.bundle.js:11328)
at __webpack_require__ (main.bundle.js:712)
(anonymous) @ h2r-shared-base.js?9483:1023
(anonymous) @ h2r-shared-base.js?9483:1047
createCommonjsModule @ h2r-shared-base.js?9483:18
(anonymous) @ h2r-shared-base.js?9483:724
./node_modules/@h2r/shared-base/fesm5/h2r-shared-base.js @ main.bundle.js:955
__webpack_require__ @ main.bundle.js:712
fn @ main.bundle.js:95
(anonymous) @ user.service.ts?cada:7
./src/main/webapp/app/shared/user/user.service.ts @ main.bundle.js:11328
__webpack_require__ @ main.bundle.js:712
fn @ main.bundle.js:95
(anonymous) @ index.ts?0ab5:7
./src/main/webapp/app/shared/index.ts @ main.bundle.js:11184
__webpack_require__ @ main.bundle.js:712
fn @ main.bundle.js:95
(anonymous) @ app.module.ts?c5f8:6
./src/main/webapp/app/app.module.ts @ main.bundle.js:9102
__webpack_require__ @ main.bundle.js:712
fn @ main.bundle.js:95
(anonymous) @ app.main.ts?38fd:3
./src/main/webapp/app/app.main.ts @ main.bundle.js:9090
__webpack_require__ @ main.bundle.js:712
fn @ main.bundle.js:95
2 @ main.bundle.js:11398
__webpack_require__ @ main.bundle.js:712
(anonymous) @ main.bundle.js:764
(anonymous) @ main.bundle.js:767
./node_modules/@h2r/shared-base/fesm5/h2r-shared-base.js
1023:16-20 "export 'default' (imported as 'core') was not found in '@angular/core'
, вот angular.json проекта lib:
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"shared-base": {
"root": "projects/shared-base",
"sourceRoot": "projects/shared-base/src",
"projectType": "library",
"prefix": "h2r",
"architect": {
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
"options": {
"tsConfig": "projects/shared-base/tsconfig.lib.json",
"project": "projects/shared-base/ng-package.json"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "projects/shared-base/test/test.ts",
"tsConfig": "projects/shared-base/test/tsconfig.spec.json",
"karmaConfig": "projects/shared-base/test/karma.conf.js"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"projects/shared-base/tsconfig.lib.json",
"projects/shared-base/test/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "shared-modules"
}
Надеюсьне знаю почему, похоже, что он не может найти @ angular / core.Может кто-нибудь объяснить мне, что может быть причиной этой проблемы?