Laravel Mix extension for Babel-transpiling dependencies inside node_modules
.
npm install laravel-mix-transpile-node-modules
Require the extension inside your webpack.mix.js
and call transpileNodeModules()
.
const mix = require('laravel-mix')
require('laravel-mix-transpile-node-modules')
mix.js('src/main.js', 'dist')
/**
* Transpile node_modules in production
*/
if (mix.inProduction()) {
mix.transpileNodeModules()
}
This is the default behavior. Same as passing true
.
mix.transpileNodeModules()
Pass an array of npm module names to transpile.
mix.transpileNodeModules(['swiper', 'dom7'])
Same as not calling the extension at all.
mix.transpileNodeModules(false)