<p dir="auto"><strong>Do you want to request a <em>feature</em> or report a <em>bug</em>?</strong></p>
<p dir="auto">Report a bug</p>


<p dir="auto"><strong>What is the current behavior?</strong></p>
<p dir="auto">When webpack config <code class="notranslate">context</code> is of the form <code class="notranslate">C:/Users/myUserName/Documents/myproject/</code> it is rejected by validation as being not absolute.</p>
<p dir="auto"><strong>If the current behavior is a bug, please provide the steps to reproduce.</strong></p>
<p dir="auto">In the node REPL, after <code class="notranslate">npm install webpack@2</code>:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt; require('webpack')({
    context: 'C:/Users/cspotcode/Documents/dev/myproject',
    entry: 'a'
});
WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration.context: The provided value &quot;C:/Users/cspotcode/Documents/dev/myproject&quot; is not an absolute path!
    at webpack (C:\Users\&lt;... truncated by me&gt;"><pre class="notranslate"><code class="notranslate">&gt; require('webpack')({
    context: 'C:/Users/cspotcode/Documents/dev/myproject',
    entry: 'a'
});
WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration.context: The provided value "C:/Users/cspotcode/Documents/dev/myproject" is not an absolute path!
    at webpack (C:\Users\&lt;... truncated by me&gt;
</code></pre></div>



<p dir="auto"><strong>What is the expected behavior?</strong></p>
<p dir="auto">The validation should recognize that path as a valid, absolute path on Windows.  <code class="notranslate">/</code> and <code class="notranslate">\</code> are both valid path separators on Windows.  Node's <code class="notranslate">path.isAbsolute()</code> indicates that the path is absolute.</p>
<p dir="auto"><strong>If this is a feature request, what is motivation or use case for changing the behavior?</strong></p>
<p dir="auto"><strong>Please mention other relevant information such as the browser version, Node.js version, webpack version, and Operating System.</strong></p>
<p dir="auto">webpack v2.7.0<br>
Windows 10<br>
node v9.2.0</p>
<p dir="auto">EDIT: related to, but not a duplicate of, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="215928491" data-permission-text="Title is private" data-url="https://github.com/webpack/webpack/issues/4530" data-hovercard-type="issue" data-hovercard-url="/webpack/webpack/issues/4530/hovercard" href="https://github.com/webpack/webpack/issues/4530">#4530</a> and <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="215964900" data-permission-text="Title is private" data-url="https://github.com/webpack/webpack/issues/4533" data-hovercard-type="pull_request" data-hovercard-url="/webpack/webpack/pull/4533/hovercard" href="https://github.com/webpack/webpack/pull/4533">#4533</a></p>
<p dir="auto">I'm working on <a href="https://github.com/alexpods/angular2-universal-starter">universal starter for angular2</a>. It should prerender the application on a server and execute it in a web worker on a client. So I have three environments (targets):</p>
<ul dir="auto">
<li><strong>browser main thread</strong></li>
<li><strong>web worker</strong></li>
<li><strong>server</strong></li>
</ul>
<p dir="auto">There are several chunks that can be shared between these three environments (in parentheses I pointed on the environments where the chunk should be executed):</p>
<ul dir="auto">
<li><code class="notranslate">vendors</code> (<strong>main_thread</strong>, <strong>web_worker</strong>, <strong>server</strong>)</li>
<li><code class="notranslate">app</code> (<strong>server</strong>, <strong>web_worker</strong>)</li>
<li><code class="notranslate">server</code> (<strong>server</strong>)</li>
<li><code class="notranslate">browser</code> (<strong>main_thread</strong>)</li>
<li><code class="notranslate">worker</code> (<strong>web_worker</strong>)</li>
</ul>
<p dir="auto">I don't want a web worker to load its own <code class="notranslate">vendors</code> chunk, which differs from the main thread <code class="notranslate">vendors</code> chunk only in a name of a callback (<code class="notranslate">webpackChunk(cunkIds, cb)</code> vs <code class="notranslate">webpackJsonp(chunkIds, cb)</code>). A <code class="notranslate">vendors</code> chunk can be huge, no need for extra traffic. Also there is no need to compile the same chunks (<code class="notranslate">app</code> and <code class="notranslate">vendors</code>) several times for different targets (and I would like to have only one config after all). So I want something like this:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="const TargetPlugin = webpack.optimize.TargetPlugin;
const CommonsChunkPlugin = webpack.optimize.CommonsChunkPlugin;

module.exports = {
  entry: {
    vendors: 'vendors.js',
    app: 'app.js',
    server: 'server.js',
    browser: 'browser.js',
    worker: 'worker.js'
  },
  output: { /* ... */ },
  plugins: [
    // remove duplicate &quot;app&quot;&quot; code from 'server', 'browser' and 'worker',
    new CommonsChunkPlugin({ name: 'app', chunks: ['server', 'browser', 'worker'], minChunks: Infinity }),
    // remove duplicate &quot;vendor&quot; code from 'server', 'browser' and 'worker',
    new CommonsChunkPlugin({ name: 'vendor', chunks: ['server', 'browser', 'worker'], minChunks: Infinity }),
    // Initial chunk for server
    new TargetPlugin({ name: 'boot_server', chunk: 'server', target: 'node'}),
    // Initial chunk for browser's main thread
    new TargetPlugin({ name: 'boot_browser', chunk: 'browser', target: 'web' }),
    // Initial chunk for web worker
    new TargetPlugin({ name: 'boot_worker', chunk: 'client', target: 'webworker' }),
  ],
};
"><pre class="notranslate"><span class="pl-k">const</span> <span class="pl-v">TargetPlugin</span> <span class="pl-c1">=</span> <span class="pl-s1">webpack</span><span class="pl-kos">.</span><span class="pl-c1">optimize</span><span class="pl-kos">.</span><span class="pl-c1">TargetPlugin</span><span class="pl-kos">;</span>
<span class="pl-k">const</span> <span class="pl-v">CommonsChunkPlugin</span> <span class="pl-c1">=</span> <span class="pl-s1">webpack</span><span class="pl-kos">.</span><span class="pl-c1">optimize</span><span class="pl-kos">.</span><span class="pl-c1">CommonsChunkPlugin</span><span class="pl-kos">;</span>

<span class="pl-smi">module</span><span class="pl-kos">.</span><span class="pl-c1">exports</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span>
  <span class="pl-c1">entry</span>: <span class="pl-kos">{</span>
    <span class="pl-c1">vendors</span>: <span class="pl-s">'vendors.js'</span><span class="pl-kos">,</span>
    <span class="pl-c1">app</span>: <span class="pl-s">'app.js'</span><span class="pl-kos">,</span>
    <span class="pl-c1">server</span>: <span class="pl-s">'server.js'</span><span class="pl-kos">,</span>
    <span class="pl-c1">browser</span>: <span class="pl-s">'browser.js'</span><span class="pl-kos">,</span>
    <span class="pl-c1">worker</span>: <span class="pl-s">'worker.js'</span>
  <span class="pl-kos">}</span><span class="pl-kos">,</span>
  <span class="pl-c1">output</span>: <span class="pl-kos">{</span> <span class="pl-c">/* ... */</span> <span class="pl-kos">}</span><span class="pl-kos">,</span>
  <span class="pl-c1">plugins</span>: <span class="pl-kos">[</span>
    <span class="pl-c">// remove duplicate "app"" code from 'server', 'browser' and 'worker',</span>
    <span class="pl-k">new</span> <span class="pl-v">CommonsChunkPlugin</span><span class="pl-kos">(</span><span class="pl-kos">{</span> <span class="pl-c1">name</span>: <span class="pl-s">'app'</span><span class="pl-kos">,</span> <span class="pl-c1">chunks</span>: <span class="pl-kos">[</span><span class="pl-s">'server'</span><span class="pl-kos">,</span> <span class="pl-s">'browser'</span><span class="pl-kos">,</span> <span class="pl-s">'worker'</span><span class="pl-kos">]</span><span class="pl-kos">,</span> <span class="pl-c1">minChunks</span>: <span class="pl-v">Infinity</span> <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">,</span>
    <span class="pl-c">// remove duplicate "vendor" code from 'server', 'browser' and 'worker',</span>
    <span class="pl-k">new</span> <span class="pl-v">CommonsChunkPlugin</span><span class="pl-kos">(</span><span class="pl-kos">{</span> <span class="pl-c1">name</span>: <span class="pl-s">'vendor'</span><span class="pl-kos">,</span> <span class="pl-c1">chunks</span>: <span class="pl-kos">[</span><span class="pl-s">'server'</span><span class="pl-kos">,</span> <span class="pl-s">'browser'</span><span class="pl-kos">,</span> <span class="pl-s">'worker'</span><span class="pl-kos">]</span><span class="pl-kos">,</span> <span class="pl-c1">minChunks</span>: <span class="pl-v">Infinity</span> <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">,</span>
    <span class="pl-c">// Initial chunk for server</span>
    <span class="pl-k">new</span> <span class="pl-v">TargetPlugin</span><span class="pl-kos">(</span><span class="pl-kos">{</span> <span class="pl-c1">name</span>: <span class="pl-s">'boot_server'</span><span class="pl-kos">,</span> <span class="pl-c1">chunk</span>: <span class="pl-s">'server'</span><span class="pl-kos">,</span> <span class="pl-c1">target</span>: <span class="pl-s">'node'</span><span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">,</span>
    <span class="pl-c">// Initial chunk for browser's main thread</span>
    <span class="pl-k">new</span> <span class="pl-v">TargetPlugin</span><span class="pl-kos">(</span><span class="pl-kos">{</span> <span class="pl-c1">name</span>: <span class="pl-s">'boot_browser'</span><span class="pl-kos">,</span> <span class="pl-c1">chunk</span>: <span class="pl-s">'browser'</span><span class="pl-kos">,</span> <span class="pl-c1">target</span>: <span class="pl-s">'web'</span> <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">,</span>
    <span class="pl-c">// Initial chunk for web worker</span>
    <span class="pl-k">new</span> <span class="pl-v">TargetPlugin</span><span class="pl-kos">(</span><span class="pl-kos">{</span> <span class="pl-c1">name</span>: <span class="pl-s">'boot_worker'</span><span class="pl-kos">,</span> <span class="pl-c1">chunk</span>: <span class="pl-s">'client'</span><span class="pl-kos">,</span> <span class="pl-c1">target</span>: <span class="pl-s">'webworker'</span> <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">,</span>
  <span class="pl-kos">]</span><span class="pl-kos">,</span>
<span class="pl-kos">}</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">Because of  the <code class="notranslate">TargetPlugin</code> the <code class="notranslate">app</code>, <code class="notranslate">vendor</code>, <code class="notranslate">server</code>, <code class="notranslate">browser</code> and <code class="notranslate">worker</code> chunks are not initial chunks anymore. They are normal chunks and can be used with any of <code class="notranslate">boot_*</code> chunks (which are initial now). Could you tell me can something like this be implemented?</p>