Answer the question
In order to leave comments, you need to log in
Asynchronous import() components?
Hello. Tell me please. For some reason, when using an asynchronous component connection via import, it gives an error
components: {
FormInput: () => import('./FormInput')
}
./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/components/Checkout.vue
Module build failed: SyntaxError: d:/ProjectRuby/ vue-lavrik/src/components/Checkout.vue: Unexpected token (114:21)
112 | },
113 | components: {
> 114 | FormInput: () => import('./FormInput')
| ^
115 | }
116 | }
117 |
import FormInput from './FormInput'
....
components: {
FormInput:
}
Answer the question
In order to leave comments, you need to log in
npm i -D babel-plugin-syntax-dynamic-import
.babelrc
{
"plugins": ["syntax-dynamic-import"]
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question