laravel-mix-transpile-node-modules
v2.0.4
Published
Laravel Mix extension for Babel-transpiling dependencies inside node_modules
Downloads
4,002
Maintainers
Readme
Laravel Mix Transpile Node Modules
Laravel Mix extension for Babel-transpiling dependencies inside node_modules
.
Installation
npm install laravel-mix-transpile-node-modules
Usage
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()
}
Options
Transpile all node modules
This is the default behavior. Same as passing true
.
mix.transpileNodeModules()
Transpile selected node modules
Pass an array of npm module names to transpile.
mix.transpileNodeModules(['swiper', 'dom7'])
Don't transpile node modules
Same as not calling the extension at all.
mix.transpileNodeModules(false)