waypoints icon indicating copy to clipboard operation
waypoints copied to clipboard

Including Waypoints in Webpack config

Open neginbasiri opened this issue 9 years ago • 3 comments

config = { entry: { vendor: [ "jquery", "waypoints", "picturefill", "babel-polyfill" ] }, plugins: [ new webpack.ProvidePlugin({ $: "jquery", waypoints: "waypoints" }) ]

}

I am getting "Module not found: Error: Cannot resolve module 'waypoints'" How to get Waypoints in the vendor file?

neginbasiri avatar Sep 14 '16 04:09 neginbasiri

The underlying problem here is being discussed over at #458.

As a workaround, I'm doing this to import waypoints in webpack: require('waypoints/lib/jquery.waypoints.js');

I'm new to webpack but I think your example will work if you add this to the config file:

  resolve: {
    alias: {
      'waypoints': 'waypoints/lib/jquery.waypoints.js'
    }
  }

jcushman avatar Oct 09 '16 20:10 jcushman

If you want to import a shortcut you have to do this instead:

resolve: {
    alias: {
      'waypoints': 'waypoints/lib'
    }
  }

Then you can import the shortcut or any other script for that mater like this:

require("waypoints/lib/jquery.waypoints.js");
require("waypoints/lib/shortcuts/sticky.js");

As a workaround until this is fully supported :)

robgha01 avatar Apr 09 '17 12:04 robgha01

So when will this actually get fully supported? It is a shame I have to deal with this by messy workarounds. Makes me want to stop using this.

stephan-v avatar Apr 21 '17 07:04 stephan-v