Roots Discourse

Sage 10 importing .pkgd javascript file

Hi All,

Does anyone know how to import .pkgd.js or .pkgd.min.js file. I always get error when i tried to import this type of file.

This dependency was not found:
ERROR in ./resources/assets/scripts/app.js

Module not found: Error: Can’t resolve ‘infinite-scroll/dist/infinite-scroll’ in '/Users/jaysongarcia/Documents/Websites/wp-twig-boiler/web/app/themes/sage-10.0.0-dev/resources/assets/scripts’

@ ./resources/assets/scripts/app.js 13:0-66

@ multi ./resources/assets/scripts/app.js ./resources/assets/styles/app.scss

How does your require/import look for that library?

Thank you for your reply but Its okay now. I figured it out that when you put a .pkgd file, you also need to import jQueryBridget in app.js

Its look like this:
import jQueryBridget from ‘jquery-bridget’;
import InfiniteScroll from ‘infinite-scroll’;

jQueryBridget(‘infiniteScroll’, InfiniteScroll);