-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When using with webpack, crossfilter is undefined #1214
Comments
Thanks @cramatt, I think there are differences between how different module systems treat module names. We've been trying to keep crossfilter2 as a drop-in replacement for crossfilter, so we didn't change the filename crossfilter.js. And this is okay for npm but I guess it doesn't work in webpack. #1213 addresses this too. |
Makes sense - I'm not really sure why webpack environment causes the first condition to evaluate to true - I guess webpack uses amd but this is not really clear. Short of changing the name it might be something that can be fixed with a webpack config, maybe something like resolve? |
I don't know much about webpack. I guess the way it imports modules looks sufficiently like AMD to follow that path. (RequireJS can also do bundling, so maybe it's doing something similar.)
|
In my config it's a simple: {
resolve: {
alias: {
'crossfilter': 'crossfilter2'
}
}
} |
For anyone else using webpack and doesn't get the |
It is too bad about the confusion of crossfilter names but unless someone suggests something dc.js can do about it, I consider this solved. |
this breaks requireJS but fixes webpack - since the community fork of crossfilter has a different package name from its filename, one or the other packaging system is going to be unhappy. requireJS users will need to rename crossfilter.js to crossfilter2.js when copying it into position, or use the requireJS paths or map configuration options to specify that the filename is different from the module name. http://requirejs.org/docs/api.html#config-paths http://requirejs.org/docs/api.html#config-map fixes #1213 fixes #1214 fixes #1261 fixes #1293 fixes #1302 breaks #1304!
As of dc.js 2.0.3 / 2.1.6, we'll break requireJS compatibility in favor of webpack compatibility. See #1304 if this creates problems for you. |
Using the latest 2-beta.32
When using with webpack the following check is true
But since you are using crossfilter2 this is undefined.
Changing this line to
define(["d3", "crossfilter2"], _dc);
fixes things.The text was updated successfully, but these errors were encountered: