Registry / devops / laravel-mix-transpile-node-modules

laravel-mix-transpile-node-modules

JSON →
library2.0.4jsnpmunverified

Laravel Mix extension for transpiling JavaScript dependencies inside node_modules with Babel. Current stable version is 2.0.4, compatible with Mix v4, v5, and v6. It selectively applies Babel transformations to problematic npm packages that fail to compile under the default webpack `exclude` rule for node_modules. Differentiator: no manual webpack config needed — simply call `mix.transpileNodeModules()` in your `webpack.mix.js` file. Actively maintained, latest updates fix Windows path issues and babel-loader detection.

npm install laravel-mix-transpile-node-modules
INSTALL
IMPORT
SIG · LARAVEL-MIX-TRANSP
L
laravel-mix-transpile-node-modules
devopsjavascriptv2.0.4
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.

transpileNodeModules
require('laravel-mix-transpile-node-modules')
import 'laravel-mix-transpile-node-modules'
This package is designed for Laravel Mix's CommonJS environment; ES module imports are not supported.
laravel-mix-transpile-node-modules
require('laravel-mix-transpile-node-modules')
const Transpile = require('laravel-mix-transpile-node-modules').default
The package registers itself as a mix extension via side effect; it exports no symbols.
mix.transpileNodeModules
if (mix.inProduction()) { mix.transpileNodeModules() }
mix.transpileNodeModules();
Calling it unconditionally may cause unnecessary transpilation in development; best practice is to conditionally call it for production builds.

Registers the extension and conditionally transpiles all node_modules in production builds.

// webpack.mix.js const mix = require('laravel-mix'); require('laravel-mix-transpile-node-modules'); mix.js('resources/js/app.js', 'public/js'); if (mix.inProduction()) { mix.transpileNodeModules(); }
Debug
Known issues
gotchaPreviously, babel-loader detection failed on Windows due to path separator mismatch. Fixed in v2.0.3.
fix
Update to v2.0.3+.
affects: <=2.0.2
gotchaEmpty webpack rule tests caused errors. Fixed in v2.0.4.
fix
Update to v2.0.4+.
affects: <=2.0.3
breakingVersion 2.0.0 dropped support for Mix v3. Only v4, v5, and v6 are supported.
fix
Upgrade Laravel Mix to v4+ or stay on v1.x of this package.
affects: >=2.0.0
gotchaTranspiling all node_modules can significantly increase build times. Use selective transpilation with array of module names when possible.
fix
Pass only the problematic packages: mix.transpileNodeModules(['swiper', 'dom7']).
affects: all
gotchaCalling mix.transpileNodeModules() in development may cause performance issues if many modules are transpiled.
fix
Wrap the call in a production check: if (mix.inProduction()) { mix.transpileNodeModules() }.
affects: all
Errors
Common errors & fixes
Error: Cannot find module 'laravel-mix-transpile-node-modules'
Package not installed or missing from package.json.
fix
Run: npm install laravel-mix-transpile-node-modules --save-dev
TypeError: mix.transpileNodeModules is not a function
require('laravel-mix-transpile-node-modules') not called before usage.
fix
Add require('laravel-mix-transpile-node-modules') at the top of your webpack.mix.js.
Error: No babel-loader found. Make sure babel-loader is installed.
babel-loader is not installed in the project.
fix
Install babel-loader: npm install babel-loader --save-dev
Upgrade
Version history
2.0.4latest on npm
Audit
Dependencies
laravel-mixrequiredPeer dependency; required to hook into the Mix webpack chain.
Agent activity
4 hits · last 30 days
node
4
Resources
laravel-mix-transpile-node-modules — npm install laravel-mix-transpile-node-modules · libregistry