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-modulesVerified import paths — ran on the pinned version, not inferred.
Registers the extension and conditionally transpiles all node_modules in production builds.
Update to v2.0.3+.
Update to v2.0.4+.
Upgrade Laravel Mix to v4+ or stay on v1.x of this package.
Pass only the problematic packages: mix.transpileNodeModules(['swiper', 'dom7']).
Wrap the call in a production check: if (mix.inProduction()) { mix.transpileNodeModules() }.Run: npm install laravel-mix-transpile-node-modules --save-dev
Add require('laravel-mix-transpile-node-modules') at the top of your webpack.mix.js.Install babel-loader: npm install babel-loader --save-dev