Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

npm run publish vs npm start #10478


User avatar
0
TimMackey created

ANZ version 8.1.0 angular/.NET Core

I have an interface FrameInfo defined as

export class FrameInfo {
    constructor(
        public fiGroupId: number,
        public fiDashboardRef: TtmDashboardComponent,
        public fiFrameId: string,

        public fiCssClass: string,
        public fiDataTable: string,
        public fiTitleText: string,
        public fiHelpPdfLink: string,
        public fiPlatforms: string,

        public fiForceCollapse: boolean,
        public fiFrameBehavior: FrameBehavior,
        public fiFrameComponentType: Type<TtmFrameBase>,

        public fiDialogEditComponent: Type<TtmDialogBase>,
        public fiDialogAddEditComponent: Type<TtmDialogBase>,
        public fiDialogOptionsComponent: Type<TtmDialogBase>,
        public fiDialogQuestionPreviewComponent: Type<TtmDialogBase>,
        public fiDialogImportComponent: Type<TtmDialogBase>,
    ) { }

which is used to populate a table with a reference to TtmDatagridComponent

    private FrameMainList: FrameInfo[];

    private createFrameMainList() {
        this.FrameMainList = new Array();
        this.FrameMainList = [
            new FrameInfo(0, this, 'fiFrameId_Buildings',
                                    FrameCssClass.Facilities,
                                    'Buildings', 'Buildings', '4',
                                    '',
                                    false,
                                    FrameBehavior.DataGrid,
                                    TtmDatagridComponent, null, 
                                    TtmDialogAddEditComponent,
                                    null, null, null),
         . . .
        ];
    }

The component TtmDatagridComponent is defined (in part) as below, with a "local_method()" which references the 'name' field of the class member 'fiFrameComponentType'

export abstract class TtmFrameBase extends AppComponentBase implements OnInit {
    @Input() frameInfo: FrameInfo;
. . .
}

export class TtmDatagridComponent extends TtmFrameBase implements OnInit, AfterViewInit {

    local_method() {
      let comp_name = this.frameInfo.fiFrameComponentType.name;
      . . .
    }
. . .
}

When this code is compiled with 'npm start' and executed in localhost, the value of 'comp_name' is 'TtmDatagridComponent', which is expected.

However, when this code is compiled with 'npm run publish', deployed to Azure and executed, the value of 'comp_name' is 't', which is erroneous.

Can you offer any ideas as to why this error occurs?


1 Answer(s)
  • User Avatar
    0
    musa.demir created

    It is not related AspNet Zero. It is about angular's minification system. Check https://stackoverflow.com/questions/48759017/angular-typescript-class-name-does-not-work-in-production-build