Answer the question
In order to leave comments, you need to log in
How to set up Laravel Mix to work with Vue?
There is router.js
, in which each time you have to specify with your hands webpackChunkNome
so that the final file is saved in the folder I specified and has the same name as the source *.Vue
file. Is it possible to somehow transfer this process to webpack.mix.js
, so as not to perform routine work?
router.js
import Vue from "vue";
import Router from "vue-router";
Vue.use(Router);
export default new Router({
mode: 'history',
routes: [
{
path: "/",
component: () => import(/* webpackChunkName: "js/shop" */ "./views/Shop.vue")
},
{
path: "/cart",
component: () => import(/* webpackChunkName: "js/cart" */ "./views/Cart.vue")
}
]
});
scss
a file directly in the component, public
a folder is created vendors~js
in it, and in it the *.js
files responsible for displaying styles ( css-loader
). How can I rename this folder and move it to a folder js
?<template>
<div></div>
</template>
<script>
export default {
//
}
</script>
<style lang="scss">
@import "app.scss";
</style>
const mix = require('laravel-mix');
mix.webpackConfig({
resolve: {
alias: {
"@": path.resolve(__dirname, 'resources/js')
}
}
});
mix.js('resources/js/app.js', 'public/js')
.sass('resources/sass/app.scss', 'public/css');
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question