User1980's avatar

Laravel mix and multiple vue files

Hello all,

I have a question about Laravel mix and vue.

in my app.js I have all my components declared as:

Vue.component('signup-component', () => import('./components/SignupComponent.vue'));
Vue.component('login-component', () => import('./components/LoginComponent.vue'));

When I run the command:

npm run dev or npm run production

My public folder fills up with files like these:

public/1.js
public/2.js
public/3.js
public/4.js
public/5.js
public/6.js

I this actually normal? I would have thought that laravel mix would create a single app.js file instead.

But right now It creates both with this setup:

mix.js('resources/js/app.js', 'public/js')
    .sass('resources/sass/app.scss', 'public/css').version();

Not sure if this should actually happen. Any idea please?

Thank you!

0 likes
3 replies
User1980's avatar

Ok I found out why this is happening, I am using this:

  "plugins": ["@babel/plugin-syntax-dynamic-import"]

Any idea how to output these files to a single directory please?

Thanks

User1980's avatar

Thank you MartinBean,

Would you recommend to do this or not please? I do not think it would cause any security issues for people to know which files are which as it is javascript at the end of the day.

Thanks

Please or to participate in this conversation.