metafizzy / infinite-scroll

📜 Automatically add next page
https://infinite-scroll.com
7.41k stars 1.74k forks source link

Error: Can't resolve './core' after npm install #952

Closed moneef closed 2 years ago

moneef commented 2 years ago

Hi, i used npm to install infinite-scroll, and required it in app.js, but when i run npm run watch i get the error below

ERROR in ./node_modules/infinite-scroll/dist/infinite-scroll.pkgd.js 800:8-25
Module not found: Error: Can't resolve './core' in '/node_modules/infinite-scroll/dist'

any help will be appreciated

ShouibAamiri commented 2 years ago

have it solved

desandro commented 2 years ago

You should import infinite-scroll. dist/infinite-scroll.pkgd.js is for browser usage.

munts commented 1 year ago

@desandro Can you explain this to me. I too am getting the same error that moneef was getting. I used npm to install infinite-scroll and masonry... I then do an import statement in my script.js

import 'infinite-scroll/dist/infinite-scroll.pkgd.min' import 'masonry-layout/dist/masonry.pkgd.min'

But when I do an npm run build, I get the "Module not found: Error: Can't resolve './core' in '/node_modules/infinite-scroll/dist'"

So, how do I get around this? Do I need to load it differently? Note, I am using this in a website which will run in the browser.

Thanks, Scott