ホーム > Laravel > How to Upgrade Laravel Mix from Version 1 to 6 in Laravel
Laravel

How to Upgrade Laravel Mix from Version 1 to 6 in Laravel

Thank you for your continued support.
This article contains advertisements that help fund our operations.

This article summarizes the method and steps I followed to upgrade Laravel Mix from version 1 to 6 in Laravel.

Introduction

I was already using Vue within a Laravel project.

Laravel 6

I am writing about the tasks I actually performed as described in the Laravel Mix - Upgrade to Mix 6 documentation.

Steps to Upgrade Laravel Mix

1. Install New Packages via Command

npm install laravel-mix@^6.0.0
npm install vue-template-compiler

2. Modify package.json

Before Modification

"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "npm run development -- --watch",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},

After Modification

"scripts": {
"development": "mix",
"watch": "mix watch",
"watch-poll": "mix watch -- --watch-options-poll=1000",
"hot": "mix watch --hot",
"production": "mix --production"
},

3. Add to webpack.mix.js

mix
  .js("resources/assets/js/app.js", "public/js")
  .sass("resources/assets/sass/app.scss", "public/css")
  .vue() // Added line

Add .vue() as shown above.

This worked for me.

Conclusion

That's all I did.

I hope this helps someone.

Please Provide Feedback
We would appreciate your feedback on this article. Feel free to leave a comment on any relevant YouTube video or reach out through the contact form. Thank you!