ngx-infinite-scroll: AOT building fails: Module not found: Error: Can't resolve 'ngx-infinite-scroll/index'

This is the building command:

ng build --environment=demos --aot --progress --verbose

and this is the error output:

ERROR in ./src/$$_gendir/app/app.module.ngfactory.ts Module not found: Error: Can't resolve 'ngx-infinite-scroll/index' in '/home/user/Git/project/Application/frontend/src/$$_gendir/app' @ ./src/$$_gendir/app/app.module.ngfactory.ts 16:0-53 @ ./src/main.ts @ multi ./src/main.ts

The code compiles correctly with tsc

Installed version: ngx-infinite-scroll@0.5.1

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 34 (29 by maintainers)

Commits related to this issue

Most upvoted comments

@orizens This pr should solve the problem without look for different configurations for who are using Rollup: https://github.com/orizens/ngx-infinite-scroll/pull/187

Greetings, Roberto

This IS the reason. Major jumps in versions, like that, is bound to cause issues.

I’d advice towards updating to 4.x @cronosxfiles.

@jcroll Are you still there? Could you try this quick fix?

Go to node_modules/ngx-infinite-scroll and rename:

  • index.d.ts -> ngx-infinite-scroll.d.ts
  • index.metadata.json -> ngx-infinite-scroll.metadata.json
  • in package.json: “typings”: “./ngx-infinite-scroll.d.ts”

and:

external: [
        '@angular/core',
        '@angular/common',
        'ngx-infinite-scroll'
      ],

Let me know (so you can work in the meantime).

Get it. I’ll fix the problem into my repo, and I’ll do a pr to this library.

This doesn’t work with angular 4.3.6 for the above stated reason. The error is: Module not found: Error: Can’t resolve ‘ngx-infinite-scroll/index’ in … What a pity. I’ll have to use the deprecated version which builds with Angular 4.3.6. I am using this in a library that gets imported into my app.