Registry / devops / laravel-mix

laravel-mix

JSON →
library6.0.49jsnpmunverified

Laravel Mix (v6.0.49 stable) is a webpack wrapper providing a clean, fluent API for defining build steps. It simplifies asset compilation for CSS/JS pre-processors in Laravel and other PHP projects. Key differentiators: zero-config setup, automatic versioning, vendor extraction, and support for Vue, React, SASS, Less, PostCSS, TypeScript, and more. Currently on v6 with webpack 5 support; active development with regular minor releases.

npm install laravel-mix
INSTALL
IMPORT
SIG · LARAVEL-MIX
L
laravel-mix
devopsjavascriptv6.0.49
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

mix
const mix = require('laravel-mix')
import mix from 'laravel-mix'
CommonJS module; ESM import may cause issues without bundler wrapper.
Mix (TypeScript)
import type { Mix } from 'laravel-mix'
const Mix = require('laravel-mix').Mix
TypeScript users should import the type for proper intellisense.
webpackConfig
mix.webpackConfig({...})
const { webpackConfig } = require('laravel-mix')
Webpack config is a method on the mix instance, not a separate export.

Basic setup: compile JS and SASS, enable versioning in production.

// webpack.mix.js const mix = require('laravel-mix'); mix.js('src/js/app.js', 'public/js') .sass('src/scss/app.scss', 'public/css') .version(); if (mix.inProduction()) { mix.minify(['public/js/app.js', 'public/css/app.css']); }
Debug
Known issues
breakingUpgrading from v5 to v6 requires webpack 5 migration. Many plugins and custom configs may break.
fix
Review upgrade guide at https://github.com/JeffreyWay/laravel-mix/blob/master/UPGRADE.md
affects: >=6.0.0
deprecatedmix.extract() is deprecated in v6. Use mix.extractVendor() instead.
fix
Replace mix.extract() with mix.extractVendor() or custom splitting.
affects: >=6.0.0
gotchaMixing ESM and CJS in webpack.mix.js can cause unexpected errors. Mix expects CommonJS require().
fix
Use require() in webpack.mix.js; avoid import/export unless transpiled by Mix itself.
affects: *
Errors
Common errors & fixes
Module not found: Error: Can't resolve 'laravel-mix/src/builder/Mix'
Incorrect import path or missing dependency.
fix
Use const mix = require('laravel-mix'); do not import submodules directly.
TypeError: mix.js is not a function
mix variable not properly initialized or overridden.
fix
Ensure const mix = require('laravel-mix'); is the first line of webpack.mix.js.
Error: PostCSS plugin postcss-import requires PostCSS 8
Mismatched PostCSS version.
fix
Update postcss to ^8.3.11 (peer dependency of laravel-mix v6).
Upgrade
Version history
6.0.49latest on npm
Audit
Dependencies
postcssoptionalpeer dependency for CSS processing
webpackrequiredcore bundler peer dependency
webpack-clirequiredwebpack CLI peer dependency
@babel/coreoptionalBabel transpilation peer dependency
Agent activity
2 hits · last 30 days
node
2
Resources
laravel-mix — npm install laravel-mix · libregistry