<h1 dir="auto">Bug report</h1>




<p dir="auto"><strong>What is the current behavior?</strong><br>
Using for example <code class="notranslate">[name].[contenthash].js</code>as the filename in output.filename leads to a compiled bundle where the <code class="notranslate">contenthash</code> gets compiled as a variable instead of a string.</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="/******/ 				var href = &quot;&quot; + ({}[chunkId]||chunkId) + &quot;.&quot; + __webpack_require__.h ? __webpack_require__.h() : 33a77d7a305d7b86ce61 + &quot;.css&quot;;
"><pre class="notranslate"><span class="pl-c">/******/</span> 				<span class="pl-k">var</span> <span class="pl-s1">href</span> <span class="pl-c1">=</span> <span class="pl-s">""</span> <span class="pl-c1">+</span> <span class="pl-kos">(</span><span class="pl-kos">{</span><span class="pl-kos">}</span><span class="pl-kos">[</span><span class="pl-s1">chunkId</span><span class="pl-kos">]</span><span class="pl-c1">||</span><span class="pl-s1">chunkId</span><span class="pl-kos">)</span> <span class="pl-c1">+</span> <span class="pl-s">"."</span> <span class="pl-c1">+</span> <span class="pl-s1">__webpack_require__</span><span class="pl-kos">.</span><span class="pl-c1">h</span> ? <span class="pl-s1">__webpack_require__</span><span class="pl-kos">.</span><span class="pl-en">h</span><span class="pl-kos">(</span><span class="pl-kos">)</span> : <span class="pl-c1">33</span><span class="pl-s1">a77d7a305d7b86ce61</span> <span class="pl-c1">+</span> <span class="pl-s">".css"</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">the using a different separator works - <code class="notranslate">[name]-[contenthash].js</code></p>
<p dir="auto"><strong>If the current behavior is a bug, please provide the steps to reproduce.</strong><br>
This occurs randomly - we had this error on different machines - with the same node/yarn etc. versions.</p>
<p dir="auto">Webpack config here -&gt; <a href="https://gist.github.com/FabianHippmann/b122bc99ed10059325720796f0259bad">https://gist.github.com/FabianHippmann/b122bc99ed10059325720796f0259bad</a></p>






<p dir="auto">Bc this also affects the mini-css-plugin i opened an issue there -&gt; <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="713043591" data-permission-text="Title is private" data-url="https://github.com/webpack-contrib/mini-css-extract-plugin/issues/596" data-hovercard-type="issue" data-hovercard-url="/webpack-contrib/mini-css-extract-plugin/issues/596/hovercard" href="https://github.com/webpack-contrib/mini-css-extract-plugin/issues/596">webpack-contrib/mini-css-extract-plugin#596</a></p>
<p dir="auto"><strong>What is the expected behavior?</strong><br>
<code class="notranslate">contenthash</code>should be compiled as a string.</p>
<p dir="auto">for example:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="/******/ 				var href = &quot;&quot; + ({}[chunkId]||chunkId) + &quot;.&quot; + __webpack_require__.h ? __webpack_require__.h() : &quot;33a77d7a305d7b86ce61&quot; + &quot;.css&quot;;
"><pre class="notranslate"><span class="pl-c">/******/</span> 				<span class="pl-k">var</span> <span class="pl-s1">href</span> <span class="pl-c1">=</span> <span class="pl-s">""</span> <span class="pl-c1">+</span> <span class="pl-kos">(</span><span class="pl-kos">{</span><span class="pl-kos">}</span><span class="pl-kos">[</span><span class="pl-s1">chunkId</span><span class="pl-kos">]</span><span class="pl-c1">||</span><span class="pl-s1">chunkId</span><span class="pl-kos">)</span> <span class="pl-c1">+</span> <span class="pl-s">"."</span> <span class="pl-c1">+</span> <span class="pl-s1">__webpack_require__</span><span class="pl-kos">.</span><span class="pl-c1">h</span> ? <span class="pl-s1">__webpack_require__</span><span class="pl-kos">.</span><span class="pl-en">h</span><span class="pl-kos">(</span><span class="pl-kos">)</span> : <span class="pl-s">"33a77d7a305d7b86ce61"</span> <span class="pl-c1">+</span> <span class="pl-s">".css"</span><span class="pl-kos">;</span></pre></div>


<p dir="auto"><strong>Other relevant information:</strong><br>
webpack version:  webpack 5.0.0-rc.3<br>
Node.js version: v12.18.4<br>
Operating System: Ubuntu 20.04<br>
Additional tools:</p>
<p dir="auto">I'm testing out webpack by converting a simple project currently built with browserify.</p>
<p dir="auto">I get the following exception:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ webpack
.../node_modules/webpack/node_modules/webpack-core/lib/NormalModuleMixin.js:42
        var i = req.indexOf(&quot;?&quot;);
                    ^
TypeError: Object false has no method 'indexOf'
    at DependenciesBlock.splitQuery (.../node_modules/webpack/node_modules/webpack-core/lib/NormalModuleMixin.js:42:14)
    at DependenciesBlock.NormalModuleMixin (.../node_modules/webpack/node_modules/webpack-core/lib/NormalModuleMixin.js:25:26)
    at DependenciesBlock.NormalModule (.../node_modules/webpack/lib/NormalModule.js:21:20)
    at .../node_modules/webpack/lib/NormalModuleFactory.js:96:7
    at Tapable.applyPluginsAsyncWaterfall (.../node_modules/webpack/node_modules/tapable/lib/Tapable.js:84:69)
    at Tapable.onDoneResolving (.../node_modules/webpack/lib/NormalModuleFactory.js:82:10)
    at Tapable.&lt;anonymous&gt; (.../node_modules/webpack/lib/NormalModuleFactory.js:78:22)
    at .../node_modules/webpack/node_modules/async/lib/async.js:232:13
    at .../node_modules/webpack/node_modules/async/lib/async.js:119:25
    at .../node_modules/webpack/node_modules/async/lib/async.js:24:16"><pre class="notranslate"><code class="notranslate">$ webpack
.../node_modules/webpack/node_modules/webpack-core/lib/NormalModuleMixin.js:42
        var i = req.indexOf("?");
                    ^
TypeError: Object false has no method 'indexOf'
    at DependenciesBlock.splitQuery (.../node_modules/webpack/node_modules/webpack-core/lib/NormalModuleMixin.js:42:14)
    at DependenciesBlock.NormalModuleMixin (.../node_modules/webpack/node_modules/webpack-core/lib/NormalModuleMixin.js:25:26)
    at DependenciesBlock.NormalModule (.../node_modules/webpack/lib/NormalModule.js:21:20)
    at .../node_modules/webpack/lib/NormalModuleFactory.js:96:7
    at Tapable.applyPluginsAsyncWaterfall (.../node_modules/webpack/node_modules/tapable/lib/Tapable.js:84:69)
    at Tapable.onDoneResolving (.../node_modules/webpack/lib/NormalModuleFactory.js:82:10)
    at Tapable.&lt;anonymous&gt; (.../node_modules/webpack/lib/NormalModuleFactory.js:78:22)
    at .../node_modules/webpack/node_modules/async/lib/async.js:232:13
    at .../node_modules/webpack/node_modules/async/lib/async.js:119:25
    at .../node_modules/webpack/node_modules/async/lib/async.js:24:16
</code></pre></div>
<p dir="auto">t.js:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="require('levelup');"><pre class="notranslate"><code class="notranslate">require('levelup');
</code></pre></div>
<p dir="auto">webpack.config.js:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="module.exports = {
    entry: &quot;./t.js&quot;,
    output: {
        filename: &quot;bundle.js&quot;
    }
}"><pre class="notranslate"><code class="notranslate">module.exports = {
    entry: "./t.js",
    output: {
        filename: "bundle.js"
    }
}
</code></pre></div>
<p dir="auto">package.json:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="{
  &quot;devDependencies&quot;: {
    &quot;levelup&quot;: &quot;~0.18.2&quot;,
    &quot;webpack&quot;: &quot;~1.0.3&quot;
  }
}"><pre class="notranslate"><code class="notranslate">{
  "devDependencies": {
    "levelup": "~0.18.2",
    "webpack": "~1.0.3"
  }
}
</code></pre></div>
<p dir="auto">I don't know enough about webpack to troubleshoot further.</p>