I got an error when using angular2-infinite-scroll. I want to reproduce it in a plunkr.
I tried to use npmcdn, so I add this line in the index.html file:
<script src="https://npmcdn.com/[email protected]"></script>
But I got the error:
Uncaught ReferenceError: require is not defined
This is my plunker.
How can I add a NPM package correctly in the plunker?
Add it to the map
object in your config.js
file and possibly also in the packages
object, if the package doesn't have a index.js
.
map: {
[...],
'angular2-infinite-scroll': 'https://npmcdn.com/[email protected]'
},
packages: {
[...],
'angular2-infinite-scroll': {
main: 'angular2-infinite-scroll.js',
defaultExtension: 'js'
}
},
working Plunker
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With