shlomiassaf / ng-router-loader

Webpack loader for NgModule lazy loading using the angular router
MIT License
46 stars 8 forks source link

Module build failed: <node_modules>/angular-library-seed/<module>.d.ts is missing from the TypeScript compilation #17

Open mmayors opened 6 years ago

mmayors commented 6 years ago

Hi,

Not sure if this is an issue with this package or just the way I'm using it but would appreciate any pointers. I have a custom Angular library that is packed in Angular Package Format using this example: https://github.com/trekhleb/angular-library-seed

Currently it only exports one module. I'm able to import the module and use it in my Angular CLI project.

I then used 'ng eject' to create a Webpack config I can customize, and added ng-router-loader to my Webpack config using the Webpack 1 example: https://shlomiassaf.github.io/ng-router-loader

{ "test": /\.ts$/, "loaders": [ "@ngtools/webpack", "ng-router-loader" ] }

When I try to build I get this error:

` ERROR in ./node_modules/angular-library-seed/orders/orders.module.d.ts Module build failed: Error: /Users/mmayors/Documents/parent/node_modules/angular-library-seed/orders/orders.module.d.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property. The missing file seems to be part of a third party library. TS files in published libraries are often a sign of a badly packaged library. Please open an issue in the library repository to alert its author and ask them to package the library using the Angular Package Format (https://goo.gl/jB3GVv). at AngularCompilerPlugin.getCompiledFile (/Users/mmayors/Documents/parent/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:653:23) at plugin.done.then (/Users/mmayors/Documents/parent/node_modules/@ngtools/webpack/src/loader.js:467:39) at at process._tickCallback (internal/process/next_tick.js:160:7) @ ./src/$$_lazy_route_resource lazy @ ./node_modules/@angular/core/esm5/core.js @ ./src/main.ts @ multi (webpack)-dev-server/client?http://localhost:4200 ./src/main.ts

ERROR in ./src/app/app-routing.module.ts Module build failed: TypeError: this.call is not a function at Object.loader (/Users/mmayors/Documents/parent/node_modules/ng-router-loader/index.js:29:14) @ ./src/app/app.module.ts 9:0-56 @ ./src/main.ts @ multi (webpack)-dev-server/client?http://localhost:4200 ./src/main.ts `

In my routes config I've tried the following: loadChildren: 'angular-library-seed#OrdersModule' loadChildren: '../../node_modules/angular-library-seed#OrdersModule'

Let me know if I'm way off base here. Thanks