Apr 23, 2022
0
Level 3
Laravel Mix compile 2 different config!
Hello everyone,
I wrote a webpack config for different ui area like below :
mix.js('resources/js/front/app.js', 'public/js')
.vue({version: 3})
.webpackConfig({
resolve: {
alias: {
'@': path.resolve('resources/js/front'),
},
},
})
.version();
&&
mix
.ts('resources/js/admin/app.ts', 'public/js/admin')
.vue({version: 3})
.extract([
'vue','vue-i18n','ziggy-js','@inertiajs','vuex','sweetalert2', 'yup','bootstrap'
], 'public/js/admin/vendor.js')
.webpackConfig({
resolve: {
alias: {
'@': path.resolve('resources/js/admin'),
},
},
});
When commenting one of them and compile everything works, for each of them. but when run together, version will be applied to below mix section, and extract to upper section.
For version, it's don't matter because i will apply them also, for alias i can use another alias like @front, but extract is getting noisy... and getting misconfigure.
At all, just think about below section :
mix
.js('resources/js/front/app.js', 'public/js')
.ts('resources/js/admin/app.ts', 'public/js/admin')
.vue({version: 3})
.extract([
'vue','vue-i18n','ziggy-js','@inertiajs','vuex','sweetalert2', 'yup','bootstrap'
], 'public/js/admin/vendor.js')
and how extract them, just from .ts('resources/js/admin/app.ts', 'public/js/admin') config, and keep .js('resources/js/front/app.js', 'public/js') without extracting.
Please or to participate in this conversation.