https://github.com/daun/laravel-mix-transpile-node-modules
Laravel Mix extension for Babel-transpiling dependencies inside node_modules
https://github.com/daun/laravel-mix-transpile-node-modules
babel laravel-mix laravel-mix-plugin transpilation
Last synced: about 1 year ago
JSON representation
Laravel Mix extension for Babel-transpiling dependencies inside node_modules
- Host: GitHub
- URL: https://github.com/daun/laravel-mix-transpile-node-modules
- Owner: daun
- License: other
- Created: 2020-07-24T12:33:15.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-04-18T11:19:53.000Z (about 4 years ago)
- Last Synced: 2025-04-14T09:11:45.342Z (about 1 year ago)
- Topics: babel, laravel-mix, laravel-mix-plugin, transpilation
- Language: JavaScript
- Homepage:
- Size: 17.6 KB
- Stars: 3
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Laravel Mix Transpile Node Modules
[](LICENSE)
[](https://npmjs.com/package/laravel-mix-transpile-node-modules)
[Laravel Mix](https://github.com/JeffreyWay/laravel-mix) extension for Babel-transpiling dependencies inside `node_modules`.
## Installation
```bash
npm install laravel-mix-transpile-node-modules
```
## Usage
Require the extension inside your `webpack.mix.js` and call `transpileNodeModules()`.
```js
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`.
```js
mix.transpileNodeModules()
```
### Transpile selected node modules
Pass an array of npm module names to transpile.
```js
mix.transpileNodeModules(['swiper', 'dom7'])
```
### Don't transpile node modules
Same as not calling the extension at all.
```js
mix.transpileNodeModules(false)
```