W
W
whowho2019-04-22 13:04:06
webpack
whowho, 2019-04-22 13:04:06

How to specify src to load async component?

Hello!
I'm trying to load a component asynchronously like this:

Vue.component(
        'test-component',
        () => import(/* webpackChunkName: "vue-test-form" */ './templates/VueTestForm/TestComponent.vue')
    );

After the build, the file dist/js/vue-test-form.js is formed, that is, the url for downloading this file is localhost/dist/js/vue-test-form.js. But vue is trying to load this file by url like localhost/vue-test-form.js.
How do I tell vue to load from localhost/dist/js/vue-test-form.js?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question