Using yarn or npm, install both Laravel Mix and Webpack to your project. I will be utilizing yarn in the examples below.
yarn add webpack laravel-mix
cp -r node_modules/laravel-mix/setup/webpack.mix.js ./
"scripts": {
"dev": "NODE_ENV=development webpack --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "NODE_ENV=development webpack --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"hot": "NODE_ENV=development webpack-dev-server --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"production": "NODE_ENV=production webpack --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
}
You're now all set! Simply hop in your webpack.mix.js file to configure the files you wish to compile.