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


<p dir="auto"><strong>What is the current behavior?</strong></p>
<p dir="auto">When I try to load dynamic module with <code class="notranslate">import('/path/to/my/module.js').then()</code> it work, but when i try to import module with <code class="notranslate">import(rootPath + '/' + myModuleName + '/index.js').then()</code> it doesn't work.</p>
<p dir="auto">I got:</p>
<div class="highlight highlight-text-shell-session notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content=" Error: Cannot find module '/Users/hubert_i/Emodyz/launcher-ezgames.eu/modules/test/index.js'.
      at /Users/hubert_i/Emodyz/launcher-ezgames.eu/dist/electron/main.js:10475:9
      at &lt;anonymous&gt;
      at process._tickCallback (internal/process/next_tick.js:188:7)"><pre class="notranslate"><span class="pl-c1"> Error: Cannot find module '/Users/hubert_i/Emodyz/launcher-ezgames.eu/modules/test/index.js'.</span>
<span class="pl-c1">      at /Users/hubert_i/Emodyz/launcher-ezgames.eu/dist/electron/main.js:10475:9</span>
<span class="pl-c1">      at &lt;anonymous&gt;</span>
<span class="pl-c1">      at process._tickCallback (internal/process/next_tick.js:188:7)</span></pre></div>
<p dir="auto"><strong>If the current behavior is a bug, please provide the steps to reproduce.</strong></p>



<p dir="auto"><strong>What is the expected behavior?</strong></p>
<p dir="auto">Dynamic import with variable</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 =&gt; 3.10.0<br>
npm =&gt; 5.6.0<br>
yarn =&gt; 1.5.1<br>
Node.js =&gt; v9.6.1<br>
Operating System =&gt; macOs High Sierra</p>
<h1 dir="auto">Bug report</h1>
<p dir="auto"><strong>What is the current behavior?</strong><br>
Webpack 5.0 fails to build with the error: "Rule can only have one resource source".</p>
<p dir="auto"><strong>If the current behavior is a bug, please provide the steps to reproduce.</strong></p>
<p dir="auto">I have create a minimal repro over at <a href="https://github.com/skaut/shared-drive-mover/tree/webpack-5-issue-repro">https://github.com/skaut/shared-drive-mover/tree/webpack-5-issue-repro</a><br>
This issue consist of many "moving parts", removing any of them leads to it not manifesting.</p>
<p dir="auto">My current behaviour of the repro is as follows:</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="$ gulp build
[18:09:32] Using gulpfile ~/shared-drive-mover/gulpfile.js
[18:09:32] Starting 'build'...
[18:09:33] 'build' errored after 349 ms
[18:09:33] Error: Rule can only have one resource source (provided resource and test + include + exclude) in {
  &quot;exclude&quot;: {},
  &quot;use&quot;: [
    {
      &quot;loader&quot;: &quot;ts-loader&quot;,
      &quot;options&quot;: {
        &quot;appendTsSuffixTo&quot;: [
          {}
        ]
      },
      &quot;ident&quot;: &quot;clonedRuleSet-1[0].rules[0]&quot;
    }
  ]
}
    at checkResourceSource (/home/user/shared-drive-mover/node_modules/webpack-stream/node_modules/webpack/lib/RuleSet.js:167:11)
    at Function.normalizeRule (/home/user/shared-drive-mover/node_modules/webpack-stream/node_modules/webpack/lib/RuleSet.js:198:4)
    at /home/user/shared-drive-mover/node_modules/webpack-stream/node_modules/webpack/lib/RuleSet.js:110:20
    at Array.map (&lt;anonymous&gt;)
    at Function.normalizeRules (/home/user/shared-drive-mover/node_modules/webpack-stream/node_modules/webpack/lib/RuleSet.js:109:17)
    at new RuleSet (/home/user/shared-drive-mover/node_modules/webpack-stream/node_modules/webpack/lib/RuleSet.js:104:24)
    at new NormalModuleFactory (/home/user/shared-drive-mover/node_modules/webpack-stream/node_modules/webpack/lib/NormalModuleFactory.js:115:18)
    at Compiler.createNormalModuleFactory (/home/user/shared-drive-mover/node_modules/webpack-stream/node_modules/webpack/lib/Compiler.js:636:31)
    at Compiler.newCompilationParams (/home/user/shared-drive-mover/node_modules/webpack-stream/node_modules/webpack/lib/Compiler.js:653:30)
    at Compiler.compile (/home/user/shared-drive-mover/node_modules/webpack-stream/node_modules/webpack/lib/Compiler.js:661:23)
    at /home/user/shared-drive-mover/node_modules/webpack-stream/node_modules/webpack/lib/Compiler.js:321:11
    at Compiler.readRecords (/home/user/shared-drive-mover/node_modules/webpack-stream/node_modules/webpack/lib/Compiler.js:529:11)
    at /home/user/shared-drive-mover/node_modules/webpack-stream/node_modules/webpack/lib/Compiler.js:318:10
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/user/shared-drive-mover/node_modules/tapable/lib/HookCodeFactory.js:33:10), &lt;anonymous&gt;:6:1)
    at AsyncSeriesHook.lazyCompileHook (/home/user/shared-drive-mover/node_modules/tapable/lib/Hook.js:154:20)
    at /home/user/shared-drive-mover/node_modules/webpack-stream/node_modules/webpack/lib/Compiler.js:315:19"><pre class="notranslate">$ gulp build
[18:09:32] Using gulpfile <span class="pl-k">~</span>/shared-drive-mover/gulpfile.js
[18:09:32] Starting <span class="pl-s"><span class="pl-pds">'</span>build<span class="pl-pds">'</span></span>...
[18:09:33] <span class="pl-s"><span class="pl-pds">'</span>build<span class="pl-pds">'</span></span> errored after 349 ms
[18:09:33] Error: Rule can only have one resource <span class="pl-c1">source</span> (provided resource and <span class="pl-c1">test</span> + include + exclude) <span class="pl-k">in</span> {
  <span class="pl-s"><span class="pl-pds">"</span>exclude<span class="pl-pds">"</span></span>: {},
  <span class="pl-s"><span class="pl-pds">"</span>use<span class="pl-pds">"</span></span>: [
    {
      <span class="pl-s"><span class="pl-pds">"</span>loader<span class="pl-pds">"</span></span>: <span class="pl-s"><span class="pl-pds">"</span>ts-loader<span class="pl-pds">"</span></span>,
      <span class="pl-s"><span class="pl-pds">"</span>options<span class="pl-pds">"</span></span>: {
        <span class="pl-s"><span class="pl-pds">"</span>appendTsSuffixTo<span class="pl-pds">"</span></span>: [
          {}
        ]
      },
      <span class="pl-s"><span class="pl-pds">"</span>ident<span class="pl-pds">"</span></span>: <span class="pl-s"><span class="pl-pds">"</span>clonedRuleSet-1[0].rules[0]<span class="pl-pds">"</span></span>
    }
  ]
}
    at checkResourceSource (/home/user/shared-drive-mover/node_modules/webpack-stream/node_modules/webpack/lib/RuleSet.js:167:11)
    at Function.normalizeRule (/home/user/shared-drive-mover/node_modules/webpack-stream/node_modules/webpack/lib/RuleSet.js:198:4)
    at /home/user/shared-drive-mover/node_modules/webpack-stream/node_modules/webpack/lib/RuleSet.js:110:20
    at Array.map (<span class="pl-k">&lt;</span>anonymous<span class="pl-k">&gt;</span>)
    at Function.normalizeRules (/home/user/shared-drive-mover/node_modules/webpack-stream/node_modules/webpack/lib/RuleSet.js:109:17)
    at new RuleSet (/home/user/shared-drive-mover/node_modules/webpack-stream/node_modules/webpack/lib/RuleSet.js:104:24)
    at new NormalModuleFactory (/home/user/shared-drive-mover/node_modules/webpack-stream/node_modules/webpack/lib/NormalModuleFactory.js:115:18)
    at Compiler.createNormalModuleFactory (/home/user/shared-drive-mover/node_modules/webpack-stream/node_modules/webpack/lib/Compiler.js:636:31)
    at Compiler.newCompilationParams (/home/user/shared-drive-mover/node_modules/webpack-stream/node_modules/webpack/lib/Compiler.js:653:30)
    at Compiler.compile (/home/user/shared-drive-mover/node_modules/webpack-stream/node_modules/webpack/lib/Compiler.js:661:23)
    at /home/user/shared-drive-mover/node_modules/webpack-stream/node_modules/webpack/lib/Compiler.js:321:11
    at Compiler.readRecords (/home/user/shared-drive-mover/node_modules/webpack-stream/node_modules/webpack/lib/Compiler.js:529:11)
    at /home/user/shared-drive-mover/node_modules/webpack-stream/node_modules/webpack/lib/Compiler.js:318:10
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/user/shared-drive-mover/node_modules/tapable/lib/HookCodeFactory.js:33:10), <span class="pl-k">&lt;</span>anonymous<span class="pl-k">&gt;</span>:6:1)
    at AsyncSeriesHook.lazyCompileHook (/home/user/shared-drive-mover/node_modules/tapable/lib/Hook.js:154:20)
    at /home/user/shared-drive-mover/node_modules/webpack-stream/node_modules/webpack/lib/Compiler.js:315:19</pre></div>
<p dir="auto">This only happens when invoking webpack through webpack-stream, but the author of that thinks the issue lies in webpack. See <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="804751725" data-permission-text="Title is private" data-url="https://github.com/shama/webpack-stream/issues/233" data-hovercard-type="issue" data-hovercard-url="/shama/webpack-stream/issues/233/hovercard" href="https://github.com/shama/webpack-stream/issues/233">shama/webpack-stream#233</a>.</p>
<p dir="auto"><strong>What is the expected behavior?</strong></p>
<p dir="auto">No crash and correct output in the <code class="notranslate">dist</code> directory - as it is with webpack@v4.</p>
<p dir="auto"><strong>Other relevant information:</strong><br>
webpack version: 5.21.2<br>
Node.js version: 14.15.5<br>
Operating System: Debian testing<br>
Additional tools: gulp, ts-loader, typescript, vue, vue-loader, webpack-stream</p>