Closed rienheuver closed 1 month ago
I'm currently using a workaround that fixes both problem:
import { Stage } from "konva/lib/Stage";
const stage = new Konva.Stage();
Now the Konva core import is used and the error is gone. But it's not the best fix of course, since I'd rather import Stage directly just as all other classes.
Please make a small demo. I can't reproduce.
Sure thing! https://github.com/rienheuver/konva-repro
Looks like vite automatically removes unused import of import Konva from 'konva/lib/Core';
.
There are two solutions:
new Konva.Stage();
import 'konva/lib/Core'
;Technically, it is possible to avoid crash on Cannot read properties of undefined (reading 'isDragging')
, but I still think core must be loaded.
Sorry for the late reply. I'll use the new Konva.Stage()
for now as a fix. Maybe it's a good idea to document this somewhere in case others use a similar setup?
I'm (also) running into the below error, as was mentioned in #1730
However, if I import the following line it doesn't fix it, the problem persists.
And there's another problem with that: vscode sees it as an unused import since I import all other Konva-object directly as below. So therefore it will want to remove that import. (I can prevent that from happening with a hack of course, but it doesn't fix the
isDragging
either way.)