agentleFS
ai-enhanced-engineerai-enhanced-engineer/aiee-skills/skills/laravel-mix-webpack/SKILL.md

laravel-mix-webpack

Skill4 starsChanged 5 months agoMITView on GitHub

Laravel Mix (Webpack wrapper) configuration for React SPAs. Babel setup, SASS compilation, asset versioning, hot module replacement. Use for build configuration, asset pipeline issues, or migration to Vite.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use mix('js/app.js') helper in Blade templates for automatic path resolution.

    line 48

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Laravel Mix Asset Compilation

Webpack wrapper for Laravel applications providing fluent API for React compilation, SASS preprocessing, and asset management. Laravel 8-10 standard (Laravel 11+ uses Vite).

When to Use

  • Configuring Laravel Mix for React SPAs
  • Setting up hot module replacement (HMR)
  • Asset versioning and cache busting
  • SASS/CSS compilation
  • Code splitting and vendor extraction
  • Troubleshooting Mix build issues
  • Planning migration from Mix to Vite

Quick Setup Pattern

mix.react('resources/js/app.js', 'public/js')
   .sass('resources/sass/app.scss', 'public/css')
   .extract(['react', 'react-dom'])
   .version();

Common Mix Methods

MethodPurposeExample
.react()Compile JSX with Babelmix.react('src/app.js', 'public/js')
.sass()Compile SASS/SCSSmix.sass('src/app.scss', 'public/css')
.version()Asset versioningAuto-generates mix-manifest.json
.extract()Vendor code splittingmix.extract(['react', 'react-dom'])
.sourceMaps()Enable source mapsFor development only

Hot Module Replacement

npx mix watch --hot

Use mix('js/app.js') helper in Blade templates for automatic path resolution.

Production Build

NODE_ENV=production npx mix --production

Migration to Vite

Laravel 11+ uses Vite by default. Key changes: rename MIX_* → VITE_* env vars, require() → import, update Blade mix() → @vite(). Performance: 10-100x faster builds.

See examples.md for step-by-step migration guide.

Anti-Patterns

Anti-PatternPattern
JSX not compilingUse mix.react() (used .js() instead of .react())
HMR not workingUse npx mix watch --hot + mix('js/app.js') helper (missing .hot flag or wrong script source)
Cache not bustingAdd mix.version() (missing .version())
Script load order errorsLoad manifest → vendor → app (incorrect .extract() ordering)
Large bundle sizeAdd .extract(['react', 'react-dom']) (no vendor extraction)

See reference.md for custom Babel config, HMR configuration, environment variable handling. See examples.md for complete webpack.mix.js configs, Vite migration step-by-step.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.