Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/hadoop/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Angular 5中导出UI组件-未找到模板_Angular_Typescript_Rollup - Fatal编程技术网

在Angular 5中导出UI组件-未找到模板

在Angular 5中导出UI组件-未找到模板,angular,typescript,rollup,Angular,Typescript,Rollup,我正在开发UI组件,用于整个公司的不同Web项目。我们希望在本地存储库中将ui组件发布为npm包。发布包 当我npm安装软件包时,在我的app.module.ts中导入模块并运行“ng serve”(这是一个Angular CLI项目),一切都可以正常编译。但在本地主机上访问站点时,不会显示任何内容,控制台会显示: 在编译和打包模板时,Angular为什么要寻找html格式的模板?以及如何告知CLI这些组件已编译? tsconfig.json(打包前) 我在网上找不到angularCompi

我正在开发UI组件,用于整个公司的不同Web项目。我们希望在本地存储库中将ui组件发布为npm包。发布包

当我npm安装软件包时,在我的
app.module.ts
中导入模块并运行“ng serve”(这是一个Angular CLI项目),一切都可以正常编译。但在本地主机上访问站点时,不会显示任何内容,控制台会显示:

在编译和打包模板时,Angular为什么要寻找html格式的模板?以及如何告知CLI这些组件已编译?


tsconfig.json(打包前)

我在网上找不到angularCompilerOptions的文档

node_modules
中的npm包是:



我通过在
button.component.ngfactory.js中搜索CSS类找到了按钮模板,但导出的
ButtonComponentNgFactory
似乎没有导入任何地方。

我无法实现这一点,但另一种方法非常有效-它将模板打包成不同的js格式,并完成了所有工作:

{
   "compilerOptions": {
      "baseUrl": ".",
      "declaration": true,
      "stripInternal": true,
      "experimentalDecorators": true,
      "emitDecoratorMetadata": true,
      "strictNullChecks": true,
      "noImplicitAny": true,
      "module": "es2015",
      "moduleResolution": "node",
      "paths": {
         "@angular/core": ["node_modules/@angular/core"],
         "@angular/common": ["node_modules/@angular/common"],
         "@angular/forms": ["node_modules/@angular/forms"],
         "@ng-bootstrap/ng-bootstrap": ["node_modules/@ng-bootstrap/ng-bootstrap"]
      },
      "rootDir": ".",
      "outDir": "dist",
      "sourceMap": true,
      "inlineSources": true,
      "target": "es5",
      "skipLibCheck": true,
      "lib": [
         "es2015",
         "dom"
      ]
   },
   "files": [
      "index.ts"
   ],
   "angularCompilerOptions": {
      "strictMetadataEmit": true
   }
}