Skip to content Skip to sidebar Skip to footer

Waypoint Npm - Error: Can't Resolve 'waypoint

I have a vue project and installed waypoints npm install waypoints I try to import it import waypoint from 'waypoints'; but get an error Error: Can't resolve 'waypoints' in /Myp

Solution 1:

Waypoints comes bundled in several flavours, even via NPM, but I couldn't work out if there's a default implementation or not. So that's why your typical import Waypoint from 'waypoints' directive doesn't work.

I resolved this for my "vanilla ES6 + Webpack" setup as follows:

import'waypoints/lib/noframework.waypoints.min.js';

const waypoint = newWaypoint({
  element: document.getElementById('myScrollTarget'),
  handler: () => {}
});

Solution 2:

Basically @markedup is right, waypoints comes with various flavours, after installing waypoints if you look into /waypoints/lib/ folder you will see zepto|jquery|noframework.waypoints.js .

In this case you would require to import it as full path i.e.

import'waypoints/lib/noframework.waypoints.min.js';

or

window.waypoint = require('waypoints/lib/noframework.waypoints');

Post a Comment for "Waypoint Npm - Error: Can't Resolve 'waypoint"