-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path162.f93006c96020462fbaf4.chunk.js
1 lines (1 loc) · 3.19 KB
/
162.f93006c96020462fbaf4.chunk.js
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[162],{423:function(n,o,e){"use strict";e.r(o),o.default='<p>The <code>LoaderOptionsPlugin</code> is unlike other plugins in that it is built for migration from webpack 1 to 2. In webpack 2, the schema for a <code>webpack.config.js</code> became stricter; no longer open for extension by other loaders and plugins. The intention is that you pass <code>options</code> directly to loaders and plugins (i.e. <code>options</code> are <strong>not</strong> global or shared).</p>\n<p>However, until a loader has been updated to depend upon options being passed directly to them, the <code>LoaderOptionsPlugin</code> exists to bridge the gap. You can configure global loader options with this plugin and all loaders will receive these options.</p>\n<pre><code class="hljs language-js"><span class="token keyword">new</span> <span class="token class-name">webpack<span class="token punctuation">.</span>LoaderOptionsPlugin</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n <span class="token comment">// Options...</span>\n<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>\n<blockquote class="warning">\n<p>This plugin will be removed in the future as it only exists for migration.</p>\n</blockquote>\n<h2 id="options">Options<a href="#options" aria-hidden="true"><span class="icon icon-link"></span></a></h2>\n<p>This plugin supports the following options:</p>\n<ul>\n<li><code>options.debug</code> (<code>boolean</code>): Whether loaders should be in <code>debug</code> mode or not. <code>debug</code> will be removed as of webpack 3.</li>\n<li><code>options.minimize</code> (<code>boolean</code>): Where loaders can be switched to minimize mode.</li>\n<li><code>options.options</code> (<code>object</code>): A configuration object that can be used to configure older loaders - this will take the same schema a <code>webpack.config.js</code>.</li>\n<li><code>options.options.context</code> (<code>string</code>): The context that can be used to configure older loaders.</li>\n<li>any other options allowed in a <code>webpack.config.js</code>....</li>\n</ul>\n<h2 id="usage">Usage<a href="#usage" aria-hidden="true"><span class="icon icon-link"></span></a></h2>\n<p>Here\'s an example of how this plugin might be used:</p>\n<pre><code class="hljs language-javascript"><span class="token keyword">new</span> <span class="token class-name">webpack<span class="token punctuation">.</span>LoaderOptionsPlugin</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n minimize<span class="token punctuation">:</span> <span class="token boolean">true</span><span class="token punctuation">,</span>\n debug<span class="token punctuation">:</span> <span class="token boolean">false</span><span class="token punctuation">,</span>\n options<span class="token punctuation">:</span> <span class="token punctuation">{</span>\n context<span class="token punctuation">:</span> __dirname\n <span class="token punctuation">}</span>\n<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>\n'}}]);