"экспорт 'default' (импортированный как 'core_1') не найден в '@angular/core'
I'm building an Angular library with ng-packagr.
При обслуживании моего приложения с использованием упакованной библиотеки я получаю следующее предупреждение: , Кроме того, при обслуживании приложения я получаю следующее сообщение об ошибке:
core_1 импортируется вместе с другими модулями сверху:import core_1, { Component, Inject, Injectable, InjectionToken, NgModule } from '@angular/core';
ОБНОВИТЬ!! Конфигурация выглядит следующим образом: ng-package.json
{
"$schema": "./node_modules/ng-packagr/ng-package.schema.json",
"src": "lib",
"dest": "dist/auth",
"workingDirectory": ".ng_build",
"lib": {
"entryFile": "public_api.ts",
"externals": {
"oidc-client": "./node_modules/oidc-client/dist/oidc-client.min.js",
"rxjs/add/operator/let": "Rx.Observable.prototype"
}
}
}
tsconfig.json
{
"compilerOptions": {
"target": "es5",
"module": "es2015",
"lib": [
"es6",
"dom"
],
"moduleResolution": "node",
"declaration": true,
"experimentalDecorators": true,
"baseUrl": ".",
"stripInternal": true,
"outDir": "./dist",
"sourceMap": true,
"inlineSources": true,
"skipLibCheck": true
},
"exclude": [
"node_modules",
"dist",
"demo",
"config",
"coverage",
"src/**/*.spec.ts"
],
"angularCompilerOptions": {
"strictMetadataEmit": true,
"skipTemplateCodegen": true,
"trace": true
}
}
0 ответов
ЭВРИКА
Исправлено игрой с tsconfig как в библиотеке, так и в проекте angular:
- tsconfig.lib.json
{
"extends": "../../tsconfig.json",
"compilerOptions": {
// these two lines
"target": "es2015",
"module": "esnext",
},
"angularCompilerOptions": {
"annotateForClosureCompiler": true,
"skipTemplateCodegen": true,
"strictMetadataEmit": true,
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true,
"enableResourceInlining": true
},
"exclude": [
"src/test.ts",
"**/*.spec.ts"
]
}
и в целевом проекте:
- tsconfig.json
{
"compilerOptions": {
"module": "esnext"
}
}
- tsconfig.app.json
{
"compilerOptions": {
"module": "esnext"
}
}