Skip to content

Is it possible to import components on demand? #265

@jevin98

Description

@jevin98

Hi author.

I originally wanted to submit a pull request to support on-demand component imports (the scenario here is that components currently can only be used through Vue's global registration method). I thought supporting `import {Arc, Layer} from 'vue-konva`` imports would improve tree-shaking.

Currently, vue-konva uses `import {Arc, Layer} from 'vue-konva``, which seems to have very poor tree-shaking performance.

However, if I directly import a specific node file in vue-konva

import {Arc} from 'konva/lib/shapes/Arc.js
import {Arrow} from 'konva/lib/shapes/Arrow.js

Directly importing specific nodes seems to cause some issues. I haven't looked closely at the konva source code, but I noticed that the entry file performs some merging logic link. So this can't be done?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions