Skip to content

Commit

Permalink
document globalOptions (#365)
Browse files Browse the repository at this point in the history
* document globalOptions

`globalOptions` is useful when a babel plugin needs non-serializable options (such as functions, callbacks), thus it's worth mentioning in the README.

* Update README.md
  • Loading branch information
anilanar authored and danez committed Mar 4, 2017
1 parent 9ea739f commit 2fbcc01
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Expand Up @@ -81,6 +81,25 @@ module: {
}
```

or by using global options:

> Be aware that this only works in webpack 1 and not in version 2.
```javascript
module: {
loaders: [
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel-loader'
}
]
},
babel: {
presets: ['es2015']
}
```

This loader also supports the following loader-specific option:

* `cacheDirectory`: Default `false`. When set, the given directory will be used to cache the results of the loader. Future webpack builds will attempt to read from the cache to avoid needing to run the potentially expensive Babel recompilation process on each run. If the value is blank (`loader: 'babel-loader?cacheDirectory'`) or `true` (`loader: babel-loader?cacheDirectory=true`) the loader will use the default cache directory in `node_modules/.cache/babel-loader` or fallback to the default OS temporary file directory if no `node_modules` folder could be found in any root directory.
Expand Down

0 comments on commit 2fbcc01

Please sign in to comment.