S
S
Sergey Khlopov2019-09-11 18:07:18
Vue.js
Sergey Khlopov, 2019-09-11 18:07:18

Why does an asynchronous component produce two files as output?

Hello, there is such a component, I did not include part of the code here, because it is not needed within the framework of this question. The filename of this component is vue-dropzone.vuea path elements/vue-dropzone.

<template>
    <vue-dropzone
            ref="myVueDropzone"
            id="dropzone"
            :options="dropzoneOptions">
        <p class="dropzone-elem__title">Загрузить изображение</p>
    </vue-dropzone>
</template>
<script>
     import VueDropzone from 'vue2-dropzone'; // Подключаю dropzone которая в node_modules, скачивал с помощью npm
     export default { ... }
</script>

Then I load this component asynchronously in another component in the following way:
const MyDropzone = () => import(/* webpackChunkName: "js/dropzone" */ './../elements/vue-dropzone');

It was expected that in the end one file will be downloaded dropzone.js, and it will have my component, and the component that was downloaded using npm vue2-dropzone. But for some reason, two files are loaded.
And they have such paths:
http://rtm/vendors~js/dropzone.js
http://rtm/js/dropzone.js
see the screenshot below.
5d790b73cd0d1026508871.png
As I understand it, along the path: http://rtm/vendors~js/dropzone.jsthere is a vue2-dropzone component
And along the path: http://rtm/js/dropzone.jsalready my component, the code of which is above.
Can you please tell me why there are two files? Thank you in advance for your response

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Khlopov, 2019-09-13
@Shlop

It seems that we need to dig in this direction:
https://webpack.js.org/plugins/split-chunks-plugin/
I'm doing this project on laravel, using laravel-mix
Link to documentation from laravel-mix
https://laravel-mix.com/docs/4.0 /quick-webpack-con...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question