Angular Error on build: 'Please add a @NgModule annotation'.

Posted by: kyle.m.vassella on 13 August 2018, 2:11 am EST

  • Posted 13 August 2018, 2:11 am EST


    I'm using Angular 6 with the latest SpreadJS demo. When trying to build to production, I get the following error:

    ERROR in : Unexpected value 'SpreadSheetsModule in E:/misc/misc2/src/assets/spread/gc.spread.sheets.angular.11.1.3.d.ts' imported by the module 'AppModule in E:/misc/misc2/src/app/app.module.ts'. Please add a @NgModule annotation.

    Otherwise, the project works fine, and ng serves work fine. Does anyone know what I can do to fix this and allow Spread to work with Angular 6 AOT compiling?
  • Marked as Answer

    Replied 13 August 2018, 8:17 pm EST


    You can copy the Angular Wrapper typescript source file into the project and refer as a file module.

    See attached.

    1. npm install, then copy the gc.spread.sheets.angular.ts (only this file) from node_modules/@grapecity/spread-sheets-angular/dist folder to src/component/spread-sheets-angular folder.

    2. modify the app.module.ts

    // import { SpreadSheetsModule } from "@grapecity/spread-sheets-angular";
    import { SpreadSheetsModule } from "../component/spread-sheets-angular/gc.spread.sheets.angular";

    Then use "ng build --prod" to build again.

    Deepak SharmaArchive (1).zip
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels