[Vuejs]-Vue ()=> import('some/component.vue') syntax

0👍

import('./SomeComp.vue') is a dynamic import. It extends on top of ES2015 module specification and currently in stage 3. As specified, import() returns a promise which is resolved when the specified module is loaded.

Currently, you will need a bundler like Webpack or Rollup. They emulate this behavior.

In the context of Vue.js, a component can be asynchronous means a component will be a function that returns a promise. When the promise is resolved, the default export value will be used as Component definition.

Leave a comment