Code Monkey home page Code Monkey logo

Comments (14)

orizens avatar orizens commented on July 17, 2024

hi.
I'm also having this issue.
can you suggest a pull request or where the fix should be?
@ocombe can you assist?

from ngx-infinite-scroll.

ocombe avatar ocombe commented on July 17, 2024

You don't want to include the ts files, it will produce a lot of errors. If you two are using systemjs, then you need to define the default extension as ".js". Something like that:

System.config({
    packages: {
        "/angular2-infinite-scroll": {"defaultExtension": "js"}
    }
});

If you're not using system.js then I need to take a look at your setup to find out where the problem is.

from ngx-infinite-scroll.

orizens avatar orizens commented on July 17, 2024

hi @ocombe
I'm using angularClass's angular 2 webpack starter.

from ngx-infinite-scroll.

bczengel avatar bczengel commented on July 17, 2024

@ocombe did you figure out how to solve this for webpack?

from ngx-infinite-scroll.

nathasm avatar nathasm commented on July 17, 2024

What I eventually did was exclude this package from the source-map-loader.

   preLoaders: [
    ** snip **
    {
        test: /\.js$/,
        loader: 'source-map-loader',
        exclude: [
          // these packages have problems with their sourcemaps
          helpers.root('node_modules/rxjs'),
          helpers.root('node_modules/@ngrx/router'),
          helpers.root('node_modules/angular2-infinite-scroll')
        ]
      }
    ],

from ngx-infinite-scroll.

bczengel avatar bczengel commented on July 17, 2024

@nathasm good call. I didn't realize that source maps were causing the problem.

from ngx-infinite-scroll.

daco avatar daco commented on July 17, 2024

I want to use this package, and npm install npm-repo works. But that's not the latest version. when npm-installing from github, I've lost the .ts files (as mentioned above).
I can't get it to work. I'm using angular-cli with system.js. How can I import this directive in a component if there's no export in a .ts file?

from ngx-infinite-scroll.

orizens avatar orizens commented on July 17, 2024

hi @daco
you should import this module as:

import { InfiniteScroll } from 'angular2-infinite-scroll';

there's no need to import the ts file.
Also, the latest package includes inline sourcemap, so if you open this file in chrome devtool, you'll see the ts implementation.

from ngx-infinite-scroll.

daco avatar daco commented on July 17, 2024

Thanks! I get
The Broccoli Plugin: [BroccoliTypeScriptCompiler] failed with:
event-list.component.ts (3, 32): Cannot find module 'angular2-infinite-scroll'

When trying to build this.

from ngx-infinite-scroll.

orizens avatar orizens commented on July 17, 2024

There's a solution for that (adopted from ng boostrap issue):
add angular2-infinite-scroll to system-config.ts:

const barrels: string[] = [
  // other Angular specific barrels...

  // other Thirdparty barrels.
  // add this one:
  'angular2-infinite-scroll',

  // other App specific barrels.
];

update system config as well in the system-config.js:

System.config({
  map: {
    '@angular': 'vendor/@angular',
    'rxjs': 'vendor/rxjs',
    'main': 'main.js',
    'angular2-infinite-scroll': 'vendor/angular2-infinite-scroll'
  },
  packages: cliSystemConfigPackages
});

add this to vendorNpmFiles angular-cli-build.js:

'angular2-infinite-scroll/**/*.js'

from ngx-infinite-scroll.

daco avatar daco commented on July 17, 2024

Hi @orizens
Thanks for your reply. I've tried your suggestion, but still no luck. Both my IDE and Broccoli tell me they cannot find the module I'm trying to import.
Maybe I'm wrong, but my logic tells me that when I'm importing something with

import { InfiniteScroll } from 'angular2-infinite-scroll'

as per your suggestion, would only work if the targeted file actually exports 'InfiniteScroll'. Since we're now working with a .js file, there's no export. Or am I missing something?

Thanks in advance :)

from ngx-infinite-scroll.

orizens avatar orizens commented on July 17, 2024

hi @daco
you're right - i forgot to note that you should import the scroller like that:

import { InfiniteScroll } from 'angular2-infinite-scroll/angular2-infinite-scroll'; 

from ngx-infinite-scroll.

daco avatar daco commented on July 17, 2024

Hi @orizen,

I've got it working now, by including .ts files in the package. Reading angular2-infinite-scroll.js I see stuff like

System.registerDynamic("src/scroller"

but in the package there's no src directory because the .ts files belonging to that directory are ignored by .npmignore. I made a fork and deleted .npmignore and npm installed that fork.
Again, I'm fairly new at this, but I could not get it to work otherwise!

from ngx-infinite-scroll.

orizens avatar orizens commented on July 17, 2024

the "js" files are generated by tsc, so the "src/scroller" is actually an identifier.
I got it working using the settings I mentioned above.

from ngx-infinite-scroll.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.