1

Is it possible to do that?

Tried

 components: {
  Fibonacci: () => import('./Fibonacci.vue')
 }

But Eslint warning about import (Parsing error: Unexpected token import). What need to change?

upd:

new Vue({
 components: { 
  Fibonacci: () => import('./Fibonacci.vue')
 }
)}
2
  • could you please provide your hole code - normally this is the correct coding and it's possible, but without your code we can't help you Commented Oct 25, 2021 at 10:42
  • do you have plugin eslint-plugin-vue ? Commented Oct 25, 2021 at 11:06

1 Answer 1

1

You can refer to this plugin: https://github.com/xunleif2e/vue-lazy-component

If you mean a page component, I think you should use vue-router if you want to lazy load a component.

BTW, i don't see components option accept a function.

components?: { [key: string]: Component<any, any, any, any> | AsyncComponent<any, any, any, any> };
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.