Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to avoid Laravel Mix compiling Vue trample in ​

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report