laravel-mix-noteslisted
Install: claude install-skill hmj1026/dhpk
# Laravel Mix 5 — webpack 4 wrapper
Mix `^5.0.9` is the last 5.x line. It is a thin, opinionated wrapper
over **webpack 4** that lives in `webpack.mix.js` at the project root.
You describe entry/output pairs with a fluent API; Mix generates the
webpack config underneath.
> Era: Laravel 5.4, Vue `^2.5.17`, PHP `>=5.6.4`. Mix 5 pins
> webpack 4 — it does **not** use webpack 5 or Vite.
---
## Signature features
### Entry / output mapping
`webpack.mix.js` declares each compiled bundle as a source → output
directory pair:
```js
const mix = require('laravel-mix');
mix.js('resources/assets/js/app.js', 'public/js')
.js('resources/assets/js/kds.js', 'public/js')
.sass('resources/assets/sass/app.scss', 'public/css');
```
`mix.js()` emits `public/js/app.js` and `public/js/kds.js`;
`mix.sass()` compiles `app.scss` to `public/css/app.css`. The second
argument is a directory (Mix keeps the source basename) — pass a file
path to rename the output. `mix.js()` enables Vue SFC support and
Babel transpilation out of the box for this era.
### Versioning and the manifest
```js
mix.js('resources/assets/js/app.js', 'public/js')
.version();
```
`.version()` appends a content hash query string and writes
`public/mix-manifest.json` mapping logical paths to hashed ones. In
Blade, resolve the hashed asset with the `mix()` helper:
```blade
<script src="{{ mix('/js/app.js') }}"></script>
```
This is the cache-busting mechanism — never hardcode the hash. Without
`.version()`, `mix()`