Skip to content

Commit e5f0fa8

Browse files
johnnyreillyTheLarkInn
authored andcommitted
Added docs for loader options plugin (and placeholder for sourcemap) (#534)
* Create loader-options-plugin.md * Create source-map-dev-tool-plugin.md * Update loader-options-plugin.md * Update loader-options-plugin.md Added myself as contributor * Update loader-options-plugin.md * Update source-map-dev-tool-plugin.md using this as a basis: https://webpack.github.io/docs/list-of-plugins.html#sourcemapdevtoolplugin * Update loader-options-plugin.md
1 parent 91b0171 commit e5f0fa8

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
title: loader-options-plugin
3+
contributors:
4+
- johnnyreilly
5+
---
6+
7+
?> Review this content
8+
9+
The `loader-options-plugin` is unlike other plugins. It exists to help people move from webpack 1 to webpack 2. With webpack 2 the schema for a `webpack.config.js` became stricter; no longer open for extension by other loaders / plugins. With webpack 2 the intention is that you pass `options` directly to loaders / plugins. i.e. options are **not** global / shared.
10+
11+
However, until a loader has been updated to depend upon options being passed directly to them, the `loader-options-plugin` exists to bridge the gap. You can configure global / shared loader options with this plugin and all loaders will receive these options.
12+
13+
In the future this plugin may be removed.
14+
15+
```javascript
16+
new webpack.LoaderOptionsPlugin(options)
17+
```
18+
19+
* `options.debug` (`boolean`): Whether loaders should be in `debug` mode or not. `debug` will be removed as of webpack 3.
20+
* `options.minimize` (`boolean`): Where loaders can be switched to minimize mode.
21+
* `options.options` (`object`): A configuration object that can be used to configure older loaders - this will take the same schema a `webpack.config.js`
22+
23+
* `options.options.context` (`string`): The context that can be used to configure older loaders
24+
* other options as in a `webpack.config.js`....
25+
26+
## Examples
27+
28+
```javascript
29+
new webpack.LoaderOptionsPlugin({
30+
minimize: true,
31+
debug: false,
32+
options {
33+
context: __dirname
34+
}
35+
})
36+
```
37+
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
title: source-map-dev-tool-plugin.md
3+
contributors:
4+
- johnnyreilly
5+
---
6+
7+
?> Review this content
8+
9+
Adds SourceMaps for assets.
10+
11+
```javascript
12+
new webpack.SourceMapDevToolPlugin(options)
13+
```
14+
15+
* `options.test` / `options.include` / `options.exclude` (`string|RegExp|Array`): Used to determine which assets should be processed. Each one can be a `RegExp` (asset filename is matched), a `string` (asset filename need to start with this string) or an `Array` of those (any of them need to be matched). `test` defaults to `.js` files if omitted.
16+
* `options.filename` (`string`): defines the output filename of the SourceMap. If no value is provided the SourceMap is inlined.
17+
* `options.append` (`string`): is appended to the original asset. Usually the `#sourceMappingURL` comment. `[url]` is replaced with a URL to the SourceMap file. `false` disables the appending.
18+
* `options.moduleFilenameTemplate` / `options.fallbackModuleFilenameTemplate` (`string`): see `output.devtoolModuleFilenameTemplate`.
19+
* `options.module` (`boolean`): (defaults to `true`) When `false` loaders do not generate SourceMaps and the transformed code is used as source instead.
20+
* `options.columns` (`boolean`): (defaults to `true`) When `false` column mappings in SourceMaps are ignored and a faster SourceMap implementation is used.
21+
* `options.lineToLine` (`{test: string|RegExp|Array, include: string|RegExp|Array, exclude: string|RegExp|Array}` matched modules uses simple (faster) line to line source mappings.
22+
23+
## Examples
24+
25+
?> TODO
26+

0 commit comments

Comments
 (0)