在Konvajs 2.5中,我曾经能够按照Readme中的说明通过定位特定的src文件来进行最少的导入。示例:
import Konva from 'konva/src/Core'
import 'konva/src/Layer'
对于v3.0.0,整个库都重写为TypeScript。我的应用程序不在TypeScript中,可能很长一段时间都没有。如何利用3.0中的树状握手功能?我会停留在旧版本中吗?我希望3.0的性能有所提高,因为我使用了大量的模式。
答案 0 :(得分:2)
konva@3.1.2
支持最小捆绑:
import Konva from 'konva/lib/Core';
// now you have Konva object with Stage, Layer, FastLayer, Group, Shape and some additional utils function.
// Also core currently already have support for drag&drop and animations.
// BUT there are no shapes (rect, circle, etc), no filters.
// but you can simply add anything you need:
import { Rect } from 'konva/lib/shapes/Rect';
// importing a shape will automatically inject it into Konva object
var rect1 = new Rect();
// or:
var shape = new Konva.Rect();
// for filters you can use this:
import { Blur } from 'konva/lib/filters/Blur';