Get the App
SLTechnology News&Howtos  ›  Development  › 

How to avoid Laravel Mix compiling Vue trample in ​

Shulou Source: shulou.com Published: 2022-06-03 14:51:11 10月04日 Update

This issue of the content of the editor will bring you about how to avoid Laravel Mix compilation Vue trample, the article is rich in content and professional analysis and description for you, after reading this article, I hope you can get something.

Laravel Mix compiled Vue crater record

Environment:

/ / package "laravel-mix": "^ 6.0.6", / / composer "laravel/framework": "^ 8.54" node version v15.14.0npm version 7.7.6

First of all, npm needs to install dependent vue, vue-loader, and vue-template-compiler.

Then open the webpack.mix.js file

/ / modify mix.js ('resources/js/app.js',' public/js') / / to mix.js ('resources/js/app.js',' public/js') .vue ()

Open / resources/js/app.js

Import Vue from 'vue' / / must introduce vue require ('. / bootstrap'); Vue.component ('welcome-component', require ('. / components/WelcomeComponent.vue') .default); / / add .default after the component or it will report an error const app = new Vue ({el:'# app'})

For instructions on .default, see https://github.com/vuejs/vue-loader/releases/tag/v13.0.0 here.

Npm run dev

That's about it. There are some changes after using Laravel-Mix 6, which are recorded here.

The above is the editor for you to share how to avoid Laravel Mix compilation Vue trample, if you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Tags: Compilation content analysis almost professional small and medium rich in content that is documents articles more environment knowledge articles assemblies industries perspectives information information channels channels Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Xiaomi Apple Microsoft Huawei