Teradata / covalent

Teradata UI Platform built on Angular Material
https://teradata.github.io/covalent/
MIT License
2.23k stars 357 forks source link

Prod build fails with 1.0.0-rc.4 #1114

Closed jbojcic1 closed 6 years ago

jbojcic1 commented 6 years ago

Do you want to request a feature or report a bug?

Bug

My app seem to be working fine while running on the development server. But when I do prod build I am getting this error:

ERROR in ../@covalent/core/covalent-core.ts(101,5): Error during template compile of 'TdLoadingComponent' Function calls are not supported in decorators but 'TdFadeInOutAnimation' was called.

My package.json:

{
  "name": "test-web",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "npm run generate-build-details; npm run generate-index-html; ng serve --proxy-config proxy.conf.json",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "generate-build-details": "ts-node git-version.ts",
    "generate-index-html": "ts-node index-html-generator.ts",
    "build-dev": "npm run generate-index-html; ng build --prod --env=dev",
    "build-prod": "npm run generate-index-html prod; ng build --prod --env=prod"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^5.2.0",
    "@angular/cdk": "^5.1.1",
    "@angular/common": "^5.2.0",
    "@angular/compiler": "^5.2.0",
    "@angular/core": "^5.2.3",
    "@angular/flex-layout": "^2.0.0-beta.12",
    "@angular/forms": "^5.2.0",
    "@angular/http": "^5.2.0",
    "@angular/material": "^5.1.1",
    "@angular/platform-browser": "^5.2.0",
    "@angular/platform-browser-dynamic": "^5.2.0",
    "@angular/router": "^5.2.0",
    "@covalent/core": "^1.0.0-rc.4",
    "@covalent/dynamic-forms": "^1.0.0-rc.4",
    "@covalent/http": "^1.0.0-rc.4",
    "@swimlane/ngx-charts": "^7.0.1",
    "angular-calendar": "^0.21.3",
    "angular2-useful-swiper": "^5.0.0",
    "blueimp-load-image": "^2.17.1",
    "change-case": "^3.0.1",
    "core-js": "^2.4.1",
    "d3": "^4.9.1",
    "flickity": "^2.0.9",
    "hammerjs": "^2.0.8",
    "jwt-decode": "^2.2.0",
    "lodash-es": "^4.17.4",
    "mime-types": "^2.1.17",
    "moment": "^2.19.1",
    "ng2-toastr": "^4.1.2",
    "ngx-color-picker": "^4.5.0",
    "ngx-facebook": "^2.4.0",
    "ngx-image-cropper": "git://git@github.com:jbojcic1/ngx-image-cropper.git#v.1.2.0",
    "normalize-scss": "^7.0.0",
    "number-to-words": "^1.2.3",
    "rxjs": "^5.5.6",
    "swiper": "^3.3.1",
    "typeface-muli": "^0.0.31",
    "web-animations-js": "^2.2.5",
    "zone.js": "^0.8.19"
  },
  "devDependencies": {
    "@angular/cli": "1.6.7",
    "@angular/compiler-cli": "^5.2.0",
    "@angular/language-service": "^5.2.0",
    "@types/jasmine": "~2.8.3",
    "@types/jasminewd2": "~2.0.2",
    "@types/lodash-es": "^4.14.7",
    "@types/moment": "^2.13.0",
    "@types/node": "^8.0.15",
    "codelyzer": "^4.0.1",
    "jasmine-core": "~2.8.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~2.0.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.2",
    "ts-node": "~4.1.0",
    "tslint": "~5.9.1",
    "typescript": "~2.5.3"
  }
}

If I upgrade typescript to 2.6.2 as suggested here, prod build works fine but then I get a runtime error:

Uncaught ReferenceError: test_file_1 is not defined

test-file.ts contains TestFile class and it's used in one of the components inputs:

@Input() file: TestFile | undefined;

Interesting thing is that error is gone if I remove | undefined and have only:

@Input() file: TestFile;

majhoos commented 6 years ago

I am experiencing similar issues with

"@covalent/core": "^1.0.0-rc.3",
"@covalent/http": "^1.0.0-rc.3",
"@covalent/markdown": "^1.0.0-rc.3",

ng build itself works but when I run ng build --prod I get

ERROR in : Unexpected value 'CovalentChipsModule in G:/project1/node_modules/@covalent/core/covalent-core.d.ts' imported by the module 'CovalentModule in

G:/project1/src/app/lib/covalent/covalent.module.ts'. Please add a @NgModule annotation.

This error happens to all covalent modules. I did a folder comparison with an older version of covalent and figured out there is a difference in the core which could cause the issue:

https://github.com/Teradata/covalent/blob/develop/src/platform/core/index.ts

has

export * from './public-api';

however older version which works [ ng build --prod] successfully has

export * from './index'; export { IconService as ɵb } from './common/services/icon.service'; export { RouterPathService as ɵa } from './common/services/router-path.service';

for the time being I have coped and pasted the older @covalent package folder until a fix comes up.

emoralesb05 commented 6 years ago

@majhoos can you try using the latest? This was supposed to be fixed in rc.4.. but we are noticing people having some issues in AoT on certain cases.. so we want to be sure

majhoos commented 6 years ago

@emoralesb05 , I upgraded to the new version and I can confirm that my issue got resolved. Many thanks.

jfinci commented 6 years ago

Hey, I am having this issue as well with --aot:


    "@angular/animations": "^5.2.0",
    "@angular/cdk": "^5.2.3",
    "@angular/common": "^5.2.0",
    "@angular/compiler": "^5.2.0",
    "@angular/core": "^5.2.0",
    "@angular/forms": "^5.2.0",
    "@angular/http": "^5.2.0",
    "@angular/material": "^5.2.3",
    "@angular/platform-browser": "^5.2.0",
    "@angular/platform-browser-dynamic": "^5.2.0",
    "@angular/router": "^5.2.0",
    "@covalent/core": "^1.0.0",
    "@covalent/highlight": "^1.0.0",
    "core-js": "^2.4.1",
    "rxjs": "^5.5.6",
    "zone.js": "^0.8.19"
  }```

ERROR in : Unexpected value 'CovalentCommonModule in /Users/finci/Development/sales-eng/sapb1/fe-admin/node_modules/@covalent/core/common/common.module.d.ts' imported by the module 'AppModule in /Users/finci/Development/sales-eng/sapb1/fe-admin/src/app/app.module.ts'. Please add a @NgModule annotation.
morenosbz commented 6 years ago

Hi! I'm having a related issue.

When i run ng build --prod --aot, shows:

ERROR in : Unexpected value 'CovalentCommonModule in /PATH/node_modules/@covalent/core/common/common.module.d.ts' imported by the module 'CovalentDynamicFormsModule in /PATH/node_modules/@covalent/dynamic-forms/covalent-dynamic-forms.d.ts'. Please add a @NgModule annotation.

I am working with this dependencies:

...
`"@angular/animations":` "^5.2.0",
"@angular/cdk": "^5.2.0",
"@angular/common": "^5.2.0",
"@angular/compiler": "^5.2.0",
"@angular/core": "^5.2.0",
"@angular/forms": "^5.2.0",
"@angular/http": "^5.2.0",
"@angular/material": "^5.2.0",
"@angular/platform-browser": "^5.2.0",
"@angular/platform-browser-dynamic": "^5.2.0",
"@angular/router": "^5.2.0",
"@covalent/core": "1.0.0-rc.4",
"@covalent/dynamic-forms": "1.0.0-rc.4",
"@covalent/highlight": "1.0.0-rc.4",
"@covalent/http": "1.0.0-rc.4",
"@covalent/markdown": "1.0.0-rc.4",
...`

I'll be very grateful if you can help me.

cp1001 commented 6 years ago

I have same issue with 1.0.0-rc.4. Even upgrade to the latest 1.0.0 would not help. By upgrade typescript to 2.6.2, then it works fine. ng build --prod And i dosen't get a runtime error,cause there's no @Input in my code.

morenosbz commented 6 years ago

@cp1001 Upgrading typescript was the solution.

Thanks!

DarshanaHettiarachchi commented 6 years ago

This is an issue with typescript. Upgrade typescript to version 2.6.2 in your project.

jeremysmartt commented 6 years ago

closing issue as resolved