Skip to content

implement and export defineAsyncComponent compatible version in 2.7.x #12608

Closed
@renatodeleao

Description

@renatodeleao

What problem does this feature solve?

  1. Allows to drop @vue/composition-api plugin after migrating from vue@^2.6.x into ^2.7.x.
  2. It makes migration from 2.x to 3.x one step easier.

If you were previously using @vue/composition-api, update imports from it to vue instead. Note that some APIs exported by the plugin, e.g. createApp, are not ported in 2.7.
https://blog.vuejs.org/posts/vue-2-7-naruto.html

The release notes do mention that some APIs are not ported to 2.7, that's why this is not a bug report because it might be intentional.

defineAsyncComponent looks like something that would be a nice addition to this final 2.x version, since async components already exist in vue2 land: the syntax just slightly changed (v2 vs v3).

Also @vue/composition-api version does it and it does not appear to use any vue3 internals, so it seems technically achievable.

What does the proposed API look like?

implement and export a defineAsyncComponent using prior art (@vue/composition-api plugin version as base).

- import { defineAsyncComponent } from '@vue/composition-api'
+ import { defineAsyncComponent } from 'vue'

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