Roots Discourse

Sage 9 + Infinite-scroll

Hi All,

I’m trying to import this infinite-scroll.pkgd.js in my main.js. When I run yarn build or yard start I’m getting errors like this:

Module parse failed: Unexpected token (464:19)
You may need an appropriate loader to handle this file type.
| this.element = element;
| // options
| this.options = { …InfiniteScroll.defaults };
| this.option( options );
| // add jQuery

@ ./resources/assets/scripts/main.js 10:0-51
@ multi ./scripts/main.js ./styles/main.scss

Does anyone know how I can import this infinite-scroll with Sage 9?

Thank you!

Can this help?

I just ran into this too but I know I had this working on an older project.

Try yarn add infinite-scroll@3.0.3

This was the version of infinite-scroll I had before so I installed it on my current project and it worked! You might be able to find a newer version in between that works as well.

Edit: FYI the latest 3.0.X version is 3.0.6, works with yarn build too