possible occuring errors while using d3 :
- can not read "sourceEvent" of null
- d3.event is always null ...
cause :
as far as i understand...
- quasar using webpack and babel
- webpack not checking "jsnext:main", it import default 'd3/index.js' and pass it to babel.
- babel try to translate es6 'import' syntax inside 'd3/index.js', but break the live binding
* may be webpack just import 'd3/build/d3.node.js' which use 'require' syntax. not sure about this part- d3.event should be mutable(live binding), but as babel broke it to immutable.
- d3.event always stay the initial state, which is null
- all other modules using d3.event broke too.
ref:
d3/d3-brush#9
d3/d3-zoom#32
d3/d3-selection-multi#15
https://stackoverflow.com/a/43846806 \
solution :
- configure webpack to resolve d3 manually import 'd3/build/d3.js'
- in case of Quasar, webpack config is in the file 'quasar.conf.js'
//find and edit this part from the 'quasar.conf.js'
build:{
extendWebpack(cfg){
...
cfg.resolve.alias['d3'] = 'd3/build/d3.js' // add this line
}if its webpack config
{
...
resolve:{
... ,
alias:{
... ,
'd3' : 'd3/build/d3.js' // add this line
...