Open pYr0x opened 6 years ago
Probably this is being detected as an AMD module because the function define
is used. You'll want to use meta.format configuration to make it be something else, cjs
will likely work.
unfortunately it doesn't work.
in "d3-color" some code like this:
define(Color, color, {
displayable: function() {
return this.rgb().displayable();
},
toString: function() {
return this.rgb() + "";
}
});
gets converted into
define('d3-color@1.1.0#build/d3-color', Color, color, {
displayable: function () {
return this.rgb().displayable();
},
toString: function () {
return this.rgb() + '';
}
});
here is a demo https://github.com/pYr0x/steal-d3
npm run deps
ok, I'll try to take a look soon.
Ok, took a look at the repo. Couple of things, first the format should be set to cjs
not amd. setting to amd causes it to override those define() functions that are no the AMD define.
"steal": {
"meta": {
"d3-color": {
"format": "amd"
}
}
}
Secondly, you can't configure modules that you don't depend on. So you need to install it as a dep:
npm install d3-color@1.1.0
Do you think this kind of thing is frequent enough that we should document it some where? Here perhaps? https://stealjs.com/docs/StealJS.configuration.html
@matthewp thanks, that was the problem. i think we should create a "troubleshooting" page. there we can put some other stuff like
cc @justinbmeyer
i want to use d3js to create charts. i was importing all d3js modules like in my main.js file
using the steal-tools cli
steal-tools bundle --deps --minify false
orsteal-tools --minify false
the build is successfully. however if i check the site i get an error: TypeError: Cannot create property 'prototype' on string 'd3-color@1.1.0#build/d3-color'the error lines are
any suggestion what is going wrong? using steal "^1.11.5" and steal-tools "^1.11.8"