shlomiassaf / angular-library-starter

Your last library starter. A complete, @angular grade, library starter
MIT License
44 stars 12 forks source link

Integrating into Universal Support Throws Error #21

Closed floralWallpaper closed 6 years ago

floralWallpaper commented 6 years ago

Note: for support questions, please use one of these channels: Chat: AngularClass.slack or Twitter: @AngularClass

TypeError: ctor is not a constructor at _createClass (/Users/mp945gl/Documents/sampleRcl/dist/server.js:10382:20) at createProviderInstance$1 (/Users/mp945gl/Documents/sampleRcl/dist/server.js:10358:26) at initNgModule (/Users/mp945gl/Documents/sampleRcl/dist/server.js:10311:28) at new NgModuleRef (/Users/mp945gl/Documents/sampleRcl/dist/server.js:11408:9) at Object.createNgModuleRef (/Users/mp945gl/Documents/sampleRcl/dist/server.js:11392:12) at NgModuleFactory_.create (/Users/mp945gl/Documents/sampleRcl/dist/server.js:14685:25) at /Users/mp945gl/Documents/sampleRcl/dist/server.js:5352:61 at ZoneDelegate.invoke (/Users/mp945gl/Documents/sampleRcl/dist/server.js:78123:26) at Object.onInvoke (/Users/mp945gl/Documents/sampleRcl/dist/server.js:4745:33) at ZoneDelegate.invoke (/Users/mp945gl/Documents/sampleRcl/dist/server.js:78122:32)

I am only exporting a one very simple component at the moment.

Import this starter into the universal-support starter.

// Routes import { ROUTES } from './my-custom.routes';

// Components import { AccordionHeaderComponent } from './components/accordion/accordion-header/accordion-header.component'; import { MyCustomService } from './my-custom.service';

@NgModule({ declarations: [ AccordionHeaderComponent, ], imports: [ CommonModule, FormsModule, ReactiveFormsModule, RouterModule.forRoot(ROUTES, { useHash: true, preloadingStrategy: PreloadAllModules }), BrowserAnimationsModule ], exports: [ AccordionHeaderComponent ], providers: [ MyCustomService ], schemas: [ CUSTOM_ELEMENTS_SCHEMA ] }) export class MyCustomModule {}


In my index.ts:
`export { RclExcaliburModule } from './module';`

... Everything else aligns with this angular-library-starter and the universal-starter
Node: v6.11.0
My Angular-library-starter:
- Angular version: 4.3.1

My Demo Site with Universal Support:
- Angular version: 4.4.6

- Browser: ALL

* **Other information** (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, gitter, etc)
This is the only issue I can find in stackoverflow with the same error: https://stackoverflow.com/questions/44597532/angular-4-unit-testing-error-typeerror-ctor-is-not-a-constructor

Am I missing something obvious? Thanks in advance.
floralWallpaper commented 6 years ago

Apologies. This was caused by my trying to access forRoot() in: RouterModule.forRoot(ROUTES, { useHash: true, preloadingStrategy: PreloadAllModules })

Once I turned that off. It works.