MasterMaps / d3-slider

D3.js slider
http://mastermaps.com
BSD 3-Clause "New" or "Revised" License
249 stars 119 forks source link

d3-slider with Require.js #45

Open gabalmat-csg opened 8 years ago

gabalmat-csg commented 8 years ago

Has anyone successfully loaded this module with require()? I'm assuming a shim is needed, but I can't figure out what it should look like. Right now I have:

require.config({ paths: { "d3": "https://d3js.org/d3.v3.min", "d3.slider": "lib/d3.slider" }, shim: { "d3.slider": { "deps": ["d3"], "exports": "d3" } } }); console.log(d3.version); d3.select("#time_slider").call(d3.slider());

This logs: 3.5.17 TypeError: d3.slider is not a function

Joe-Withey commented 8 years ago

I'm using webpack to import and it appears to work well like this.

d3.slider = require('d3.slider');

Don't forget the css file!

require('!style!css!d3.slider/d3.slider.css');