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

defensive check for error in browser #1828

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

Conversation

tbo47
Copy link

@tbo47 tbo47 commented Oct 4, 2024

I have an error when using in the browser (angular 18). It's probably because the Global object is not defined in the browser.

With this defensive check, everything works fine.

@lavrton
Copy link
Member

lavrton commented Oct 5, 2024

Would it be possible for you to make a demo where the issue is reproducible? It looks like some more profound issue. Drag&drop module must exist.

@tbo47
Copy link
Author

tbo47 commented Oct 5, 2024

core.mjs:7192 ERROR TypeError: Cannot read properties of undefined (reading 'isDragging')
    at Object.isDragging (Global.js:42:28)
    at Stage._pointermove (Stage.js:417:19)
    at content.addEventListener.passive (Stage.js:305:32)
    at _ZoneDelegate.invokeTask (zone.js:402:33)

It's happening if I only use this kind of import import { Layer } from 'konva/lib/Layer'. It's not happening when using import * as konva from 'konva'.

But I don't want to use the * notation as it prevent tree shaking with webpack.

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