Skip to content
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

Importing d3.mouse via module instead of via <script/> reference on m… #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mebrein
Copy link

@mebrein mebrein commented Apr 11, 2019

I use the cubism esm module now via a React useEffect hook. When import the mouse function via the module system, it doesn't throw anymore.

@BigFatDog
Copy link
Owner

Thank you for this PR. I'll try to finish review this week.

@BigFatDog
Copy link
Owner

I've tested your code via running npm run dev
stock.html prints error:

Uncaught TypeError: Cannot read property 'sourceEvent' of null

This is exactly the issue I had when I tried to use mouse in a modular approach. After some investigation, I think it might be an issue with d3-selection's packaging process with rollup. I have no solution for this.

To get rid of this issue, one possible solution is to add d3 to your global namespace via webpack:

    new webpack.ProvidePlugin({
        d3: 'd3',
    }),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants