Angular 2外部lib错误

时间:2017-08-10 13:44:28

标签: javascript angular lib

我使用yeoman generator生成我的角度2 lib并添加到主角度项目中。如果我在开发模式下编译应用程序我没有错误,但如果我运行prod模式,我会收到很多错误:

WARNING in ./src/$$_gendir/app/services/main/main.component.ngfactory.ts
142:86-92 "export 'ɵb' (imported as 'i15') was not found in 'ngx-tel-input'
at HarmonyImportSpecifierDependency._getErrors (/Users/franke/projects/work/jsapp/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js:65:15)
at HarmonyImportSpecifierDependency.getWarnings (/Users/franke/projects/work/jsapp/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js:39:15)
at Compilation.reportDependencyErrorsAndWarnings (/Users/franke/projects/work/jsapp/node_modules/webpack/lib/Compilation.js:677:24)
at Compilation.finish (/Users/franke/projects/work/jsapp/node_modules/webpack/lib/Compilation.js:535:9)
at applyPluginsParallel.err (/Users/franke/projects/work/jsapp/node_modules/webpack/lib/Compiler.js:512:17)
at /Users/franke/projects/work/jsapp/node_modules/tapable/lib/Tapable.js:271:11
at _addModuleChain (/Users/franke/projects/work/jsapp/node_modules/webpack/lib/Compilation.js:481:11)
at processModuleDependencies.err (/Users/franke/projects/work/jsapp/node_modules/webpack/lib/Compilation.js:452:13)
at _combinedTickCallback (internal/process/next_tick.js:73:7)
at process._tickCallback (internal/process/next_tick.js:104:9)

WARNING in ./src/$$_gendir/app/services/main/main.component.ngfactory.ts
144:12-18 "export 'ɵb' (imported as 'i15') was not found in 'ngx-tel-input'
at HarmonyImportSpecifierDependency._getErrors (/Users/franke/projects/work/jsapp/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js:65:15)
at HarmonyImportSpecifierDependency.getWarnings (/Users/franke/projects/work/jsapp/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js:39:15)
at Compilation.reportDependencyErrorsAndWarnings (/Users/franke/projects/work/jsapp/node_modules/webpack/lib/Compilation.js:677:24)
at Compilation.finish (/Users/franke/projects/work/jsapp/node_modules/webpack/lib/Compilation.js:535:9)
at applyPluginsParallel.err (/Users/franke/projects/work/jsapp/node_modules/webpack/lib/Compiler.js:512:17)
at /Users/franke/projects/work/jsapp/node_modules/tapable/lib/Tapable.js:271:11
at _addModuleChain (/Users/franke/projects/work/jsapp/node_modules/webpack/lib/Compilation.js:481:11)
at processModuleDependencies.err (/Users/franke/projects/work/jsapp/node_modules/webpack/lib/Compilation.js:452:13)
at _combinedTickCallback (internal/process/next_tick.js:73:7)
at process._tickCallback (internal/process/next_tick.js:104:9)

WARNING in ./src/$$_gendir/node_modules/ngx-tel-input/ngx-tel-input.ngfactory.ts
148:12-17 "export 'ɵb' (imported as 'i1') was not found in 'ngx-tel-input'
at HarmonyImportSpecifierDependency._getErrors (/Users/franke/projects/work/jsapp/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js:65:15)
at HarmonyImportSpecifierDependency.getWarnings (/Users/franke/projects/work/jsapp/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js:39:15)
at Compilation.reportDependencyErrorsAndWarnings (/Users/franke/projects/work/jsapp/node_modules/webpack/lib/Compilation.js:677:24)
at Compilation.finish (/Users/franke/projects/work/jsapp/node_modules/webpack/lib/Compilation.js:535:9)
at applyPluginsParallel.err (/Users/franke/projects/work/jsapp/node_modules/webpack/lib/Compiler.js:512:17)
at /Users/franke/projects/work/jsapp/node_modules/tapable/lib/Tapable.js:271:11
at _addModuleChain (/Users/franke/projects/work/jsapp/node_modules/webpack/lib/Compilation.js:481:11)
at processModuleDependencies.err (/Users/franke/projects/work/jsapp/node_modules/webpack/lib/Compilation.js:452:13)
at _combinedTickCallback (internal/process/next_tick.js:73:7)
at process._tickCallback (internal/process/next_tick.js:104:9)

WARNING in ./src/$$_gendir/node_modules/ngx-tel-input/ngx-tel-input.ngfactory.ts
148:46-51 "export 'ɵb' (imported as 'i1') was not found in 'ngx-tel-input'
at HarmonyImportSpecifierDependency._getErrors (/Users/franke/projects/work/jsapp/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js:65:15)
at HarmonyImportSpecifierDependency.getWarnings (/Users/franke/projects/work/jsapp/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js:39:15)
at Compilation.reportDependencyErrorsAndWarnings (/Users/franke/projects/work/jsapp/node_modules/webpack/lib/Compilation.js:677:24)
at Compilation.finish (/Users/franke/projects/work/jsapp/node_modules/webpack/lib/Compilation.js:535:9)
at applyPluginsParallel.err (/Users/franke/projects/work/jsapp/node_modules/webpack/lib/Compiler.js:512:17)
at /Users/franke/projects/work/jsapp/node_modules/tapable/lib/Tapable.js:271:11
at _addModuleChain (/Users/franke/projects/work/jsapp/node_modules/webpack/lib/Compilation.js:481:11)
at processModuleDependencies.err (/Users/franke/projects/work/jsapp/node_modules/webpack/lib/Compilation.js:452:13)
at _combinedTickCallback (internal/process/next_tick.js:73:7)
at process._tickCallback (internal/process/next_tick.js:104:9)

WARNING in ./src/$$_gendir/node_modules/ngx-tel-input/ngx-tel-input.ngfactory.ts
152:46-51 "export 'ɵb' (imported as 'i1') was not found in 'ngx-tel-input'
at HarmonyImportSpecifierDependency._getErrors (/Users/franke/projects/work/jsapp/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js:65:15)
at HarmonyImportSpecifierDependency.getWarnings (/Users/franke/projects/work/jsapp/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js:39:15)
at Compilation.reportDependencyErrorsAndWarnings (/Users/franke/projects/work/jsapp/node_modules/webpack/lib/Compilation.js:677:24)
at Compilation.finish (/Users/franke/projects/work/jsapp/node_modules/webpack/lib/Compilation.js:535:9)
at applyPluginsParallel.err (/Users/franke/projects/work/jsapp/node_modules/webpack/lib/Compiler.js:512:17)
at /Users/franke/projects/work/jsapp/node_modules/tapable/lib/Tapable.js:271:11
at _addModuleChain (/Users/franke/projects/work/jsapp/node_modules/webpack/lib/Compilation.js:481:11)
at processModuleDependencies.err (/Users/franke/projects/work/jsapp/node_modules/webpack/lib/Compilation.js:452:13)
at _combinedTickCallback (internal/process/next_tick.js:73:7)
at process._tickCallback (internal/process/next_tick.js:104:9)

ERROR in ng:///Users/franke/projects/work/jsapp/node_modules/ngx-tel-input/ngx-tel-input.d.ts.ɵb.html (4,6): Property 'number' does not exist on type 'TelInputComponent'.

问题是什么以及如何解决?

PS 我的lib:https://github.com/LPgenerator/ngx-tel-input

1 个答案:

答案 0 :(得分:1)

您的意图可能是导出所需内容,但您需要导出src/index.ts文件中的所有内容,包括所有服务,指令和管道。