twp0217 / ngx-echarts

Apache ECharts component for Angular(基于 Angular 的 Apache ECharts 组件)
https://twp0217.github.io/ngx-echarts/
82 stars 25 forks source link

node_modules/echarts-ng2/src/component/echarts-ng2.component.ngfactory.ts is not part of the compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property. #22

Closed simeon49 closed 6 years ago

simeon49 commented 6 years ago

执行命令 ng build --prod 时报下面的错误:

node_modules/echarts-ng2/src/component/echarts-ng2.component.ngfactory.ts is not part of the compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.

Versions

Angular CLI: 1.6.0
Node: 8.9.1
OS: linux x64
Angular: 5.1.0
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cdk: 2.0.0-beta.12
@angular/cli: 1.6.0
@angular/material: 2.0.0-beta.12
@angular-devkit/build-optimizer: 0.0.35
@angular-devkit/core: 0.0.22
@angular-devkit/schematics: 0.0.41
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.0
@schematics/angular: 0.1.10
@schematics/schematics: 0.0.10
typescript: 2.4.2
webpack: 3.10.0

Repro steps. ng build --prod

package.json
"dependencies": {
    "@angular/animations": "^5.0.0",
    "@angular/cdk": "^2.0.0-beta.12",
    "@angular/common": "^5.0.0",
    "@angular/compiler": "^5.0.0",
    "@angular/core": "^5.0.0",
    "@angular/forms": "^5.0.0",
    "@angular/http": "^5.0.0",
    "@angular/material": "^2.0.0-beta.12",
    "@angular/platform-browser": "^5.0.0",
    "@angular/platform-browser-dynamic": "^5.0.0",
    "@angular/router": "^5.0.0",
    "angular2-jwt": "^0.2.3",
    "core-js": "^2.4.1",
    "echarts-ng2": "^1.4.1",
    "rxjs": "^5.5.2",
    "zone.js": "^0.8.14"
  }
tsconfig.json
{
  "compileOnSave": false,
  "compilerOptions": {
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2017",
      "dom"
    ]
  }
}
tsconfig.app.json
{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/app",
    "baseUrl": "./",
    "module": "es2015",
    "types": []
  },
  "exclude": [
    "test.ts",
    "**/*.spec.ts"
  ]
}
tsconfig.spec.json
{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/spec",
    "baseUrl": "./",
    "module": "commonjs",
    "target": "es5",
    "types": [
      "jasmine",
      "node"
    ]
  },
  "files": [
    "test.ts"
  ],
  "include": [
    "**/*.spec.ts",
    "**/*.d.ts"
  ]
}
twp0217 commented 6 years ago

你可以参考下这篇文章 https://github.com/angular/angular/issues/20091

twp0217 commented 6 years ago

tsconfig.json 增加下面配置:

"include": [
    "src/**/*",
    "node_modules/echarts-ng2/src/component/echarts-ng2.module.ts"
  ]

全部信息:

{
  "compileOnSave": false,
  "compilerOptions": {
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2017",
      "dom"
    ]
  },
  "include": [
    "src/**/*",
    "node_modules/echarts-ng2/src/component/echarts-ng2.module.ts"
  ]
}