<h1 dir="auto">Bug report</h1>
<p dir="auto"><strong>Summary</strong></p>
<p dir="auto">When using <code class="notranslate">splitChunks</code> with <code class="notranslate">chunks: 'all'</code>, and the <code class="notranslate">maxInitialRequests</code> limit is hit by certain entrypoints, the automatically generated chunk names are incorrect (they list the wrong pages between the <code class="notranslate">~</code>) and therefore can result in <code class="notranslate">minChunks</code> not being honoured.</p>
<p dir="auto"><strong>If the current behavior is a bug, please provide the steps to reproduce.</strong></p>
<ol dir="auto">
<li><code class="notranslate">git clone https://github.com/edmorley/testcase-webpack-splitchunks-naming.git &amp;&amp; cd testcase-webpack-splitchunks-naming</code></li>
<li><code class="notranslate">yarn install</code></li>
<li><code class="notranslate">yarn build</code></li>
</ol>
<p dir="auto">(I've tried to reduce the testcase as much as possible, but if I remove any more the issue stops occurring. However there are 90% fewer source files, ~half the entrypoints and a much smaller webpack config than at the start, so hopefully that's enough :-))</p>
<p dir="auto"><strong>What is the expected behavior?</strong></p>
<p dir="auto">Since <code class="notranslate">splitChunks.maxInitialRequests: 5</code>, there should be no more than five files for each entrypoint (including the entrypoint itself) that contain the name of the entrypoint.</p>
<p dir="auto">In addition, the <code class="notranslate">minChunks: 2</code> should be honoured, and so no non-vendor chunks created, that aren't used by at least 2 entrypoints.</p>
<p dir="auto"><strong>What is the current behavior?</strong></p>
<p dir="auto">There are 6 files containing the string <code class="notranslate">index</code>:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ ls -1 dist/*index*
dist/index.js
dist/index~logviewer~perf.js
dist/vendors~index.js
dist/vendors~index~logviewer~perf.js
dist/vendors~index~logviewer~perf~userguide.js
dist/vendors~index~perf.js"><pre class="notranslate"><code class="notranslate">$ ls -1 dist/*index*
dist/index.js
dist/index~logviewer~perf.js
dist/vendors~index.js
dist/vendors~index~logviewer~perf.js
dist/vendors~index~logviewer~perf~userguide.js
dist/vendors~index~perf.js
</code></pre></div>
<p dir="auto">...and similarly, 6 containing the string <code class="notranslate">perf</code>:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ ls -1 dist/*perf*
dist/index~logviewer~perf.js
dist/perf.js
dist/vendors~index~logviewer~perf.js
dist/vendors~index~logviewer~perf~userguide.js
dist/vendors~index~perf.js
dist/vendors~perf.js"><pre class="notranslate"><code class="notranslate">$ ls -1 dist/*perf*
dist/index~logviewer~perf.js
dist/perf.js
dist/vendors~index~logviewer~perf.js
dist/vendors~index~logviewer~perf~userguide.js
dist/vendors~index~perf.js
dist/vendors~perf.js
</code></pre></div>
<p dir="auto">However the build output only lists 5 files for each:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Entrypoints:

  index (937 KiB)
      vendors~index~logviewer~perf~userguide.js
      vendors~index~logviewer~perf.js
      vendors~index~perf.js
      vendors~index.js
      index.js

  perf (742 KiB)
      vendors~index~logviewer~perf~userguide.js
      vendors~index~logviewer~perf.js
      vendors~index~perf.js
      vendors~perf.js
      perf.js"><pre class="notranslate"><code class="notranslate">Entrypoints:

  index (937 KiB)
      vendors~index~logviewer~perf~userguide.js
      vendors~index~logviewer~perf.js
      vendors~index~perf.js
      vendors~index.js
      index.js

  perf (742 KiB)
      vendors~index~logviewer~perf~userguide.js
      vendors~index~logviewer~perf.js
      vendors~index~perf.js
      vendors~perf.js
      perf.js
</code></pre></div>
<p dir="auto">The file missing from above is <code class="notranslate">index~logviewer~perf.js</code>, which is only listed under the <code class="notranslate">logviewer</code> entrypoint:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="  logviewer (591 KiB)
      vendors~index~logviewer~perf~userguide.js
      vendors~index~logviewer~perf.js
      index~logviewer~perf.js
      logviewer.js"><pre class="notranslate"><code class="notranslate">  logviewer (591 KiB)
      vendors~index~logviewer~perf~userguide.js
      vendors~index~logviewer~perf.js
      index~logviewer~perf.js
      logviewer.js
</code></pre></div>
<p dir="auto">Inspecting the generated output using <code class="notranslate">BundleAnalyzerPlugin</code> shows that the <code class="notranslate">index~logviewer~perf.js</code> file's content is repeated inside <code class="notranslate">index.js</code> and <code class="notranslate">perf.js</code>.</p>
<p dir="auto">As such, my hunch is that due to <code class="notranslate">maxInitialRequests</code>, the extra chunk wasn't able to be used by <code class="notranslate">index.js</code> and <code class="notranslate">perf.js</code> (so the content duplicated in them), but that the naming function didn't adjust the name of <code class="notranslate">index~logviewer~perf.js</code> to no longer reference those page names (ie change it back to just <code class="notranslate">logviewer</code>).</p>
<p dir="auto">This means that <code class="notranslate">index~logviewer~perf.js</code> is only referenced by one entrypoint (<code class="notranslate">logviewer</code>), but yet is in it's own separate chunk, thereby not adhering to the <code class="notranslate">minChunks: 2</code> requirement.</p>
<p dir="auto">The full build output is:</p>
<details>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="testcase-webpack-splitchunks-naming $ yarn build
yarn run v1.6.0
(node:4376) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
$ webpack
clean-webpack-plugin: C:\Users\Ed\src\testcase-webpack-splitchunks-naming\dist has been removed.
Hash: 578af10f8f40529aee2f
Version: webpack 4.8.3
Time: 1961ms
Built at: 2018-05-16 21:58:12
                                    Asset      Size  Chunks                    Chunk Names
vendors~index~logviewer~perf~userguide.js   174 KiB       0  [emitted]         vendors~index~logviewer~perf~userguide
          vendors~index~logviewer~perf.js   397 KiB       1  [emitted]  [big]  vendors~index~logviewer~perf
                    vendors~index~perf.js   119 KiB       2  [emitted]         vendors~index~perf
                  index~logviewer~perf.js  13.5 KiB       3  [emitted]         index~logviewer~perf
                          vendors~perf.js  36.5 KiB       4  [emitted]         vendors~perf
                         vendors~index.js   218 KiB       5  [emitted]         vendors~index
                             userguide.js  1.27 KiB       6  [emitted]         userguide
                             logviewer.js   7.1 KiB       7  [emitted]         logviewer
                                  perf.js  16.4 KiB    8, 3  [emitted]         perf
                                 index.js  30.3 KiB    9, 3  [emitted]         index
Entrypoint index [big] = vendors~index~logviewer~perf~userguide.js vendors~index~logviewer~perf.js vendors~index~perf.js vendors~index.js index.js
Entrypoint perf [big] = vendors~index~logviewer~perf~userguide.js vendors~index~logviewer~perf.js vendors~index~perf.js vendors~perf.js perf.js
Entrypoint logviewer [big] = vendors~index~logviewer~perf~userguide.js vendors~index~logviewer~perf.js index~logviewer~perf.js logviewer.js
Entrypoint userguide = vendors~index~logviewer~perf~userguide.js userguide.js
  [0] ./src/js/treeherder.js 274 bytes {3} {8} {9} [built]
  [4] ./src/js/constants.js 12.4 KiB {3} {8} {9} [built]
  [5] ./src/js/services/taskcluster.js 1.73 KiB {3} {8} {9} [built]
  [8] ./src/helpers/urlHelper.js + 2 modules 6.22 KiB {3} {8} {9} [built]
      | ./src/helpers/urlHelper.js 5.23 KiB [built]
      | ./src/helpers/locationHelper.js 220 bytes [built]
      | ./src/helpers/revisionHelper.js 789 bytes [built]
 [10] ./src/partials/main/tcjobactions.html 1.95 KiB {3} {8} {9} [built]
 [18] ./src/helpers/jobHelper.js 4.58 KiB {7} {9} [built]
 [23] ./src/js/filters.js 2.09 KiB {3} {8} {9} [built]
 [28] ./src/js/services/tcactions.js 5.8 KiB {3} {8} {9} [built]
 [37] ./src/js/services/main.js 4.59 KiB {7} {8} [built]
 [68] ./src/partials/main/intermittent.html 5.26 KiB {9} [built]
 [72] ./src/entry-userguide.js + 1 modules 515 bytes {6} [built]
      | ./src/entry-userguide.js 25 bytes [built]
      | ./src/js/userguide.js 485 bytes [built]
 [73] ./src/entry-perf.js + 2 modules 1.74 KiB {8} [built]
      | ./src/entry-perf.js 169 bytes [built]
      | ./src/js/perf.js 401 bytes [built]
      | ./src/js/models/option_collection.js 1.13 KiB [built]
 [74] ./src/entry-logviewer.js + 2 modules 11.9 KiB {7} [built]
      | ./src/entry-logviewer.js 170 bytes [built]
      | ./src/js/logviewer.js 1.11 KiB [built]
      | ./src/js/controllers/logviewer.js 10.6 KiB [built]
 [75] ./src/entry-index.js + 2 modules 31.5 KiB {9} [built]
      | ./src/entry-index.js 139 bytes [built]
      | ./src/js/treeherder_app.js 2.25 KiB [built]
      | ./src/plugins/controller.js 29 KiB [built]
[151] (webpack)/buildin/module.js 519 bytes {1} [built]
    + 146 hidden modules

WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets:
  vendors~index~logviewer~perf.js (397 KiB)

WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
  index (937 KiB)
      vendors~index~logviewer~perf~userguide.js
      vendors~index~logviewer~perf.js
      vendors~index~perf.js
      vendors~index.js
      index.js
  perf (742 KiB)
      vendors~index~logviewer~perf~userguide.js
      vendors~index~logviewer~perf.js
      vendors~index~perf.js
      vendors~perf.js
      perf.js
  logviewer (591 KiB)
      vendors~index~logviewer~perf~userguide.js
      vendors~index~logviewer~perf.js
      index~logviewer~perf.js
      logviewer.js


WARNING in webpack performance recommendations:
You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
For more info visit https://webpack.js.org/guides/code-splitting/"><pre class="notranslate"><code class="notranslate">testcase-webpack-splitchunks-naming $ yarn build
yarn run v1.6.0
(node:4376) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
$ webpack
clean-webpack-plugin: C:\Users\Ed\src\testcase-webpack-splitchunks-naming\dist has been removed.
Hash: 578af10f8f40529aee2f
Version: webpack 4.8.3
Time: 1961ms
Built at: 2018-05-16 21:58:12
                                    Asset      Size  Chunks                    Chunk Names
vendors~index~logviewer~perf~userguide.js   174 KiB       0  [emitted]         vendors~index~logviewer~perf~userguide
          vendors~index~logviewer~perf.js   397 KiB       1  [emitted]  [big]  vendors~index~logviewer~perf
                    vendors~index~perf.js   119 KiB       2  [emitted]         vendors~index~perf
                  index~logviewer~perf.js  13.5 KiB       3  [emitted]         index~logviewer~perf
                          vendors~perf.js  36.5 KiB       4  [emitted]         vendors~perf
                         vendors~index.js   218 KiB       5  [emitted]         vendors~index
                             userguide.js  1.27 KiB       6  [emitted]         userguide
                             logviewer.js   7.1 KiB       7  [emitted]         logviewer
                                  perf.js  16.4 KiB    8, 3  [emitted]         perf
                                 index.js  30.3 KiB    9, 3  [emitted]         index
Entrypoint index [big] = vendors~index~logviewer~perf~userguide.js vendors~index~logviewer~perf.js vendors~index~perf.js vendors~index.js index.js
Entrypoint perf [big] = vendors~index~logviewer~perf~userguide.js vendors~index~logviewer~perf.js vendors~index~perf.js vendors~perf.js perf.js
Entrypoint logviewer [big] = vendors~index~logviewer~perf~userguide.js vendors~index~logviewer~perf.js index~logviewer~perf.js logviewer.js
Entrypoint userguide = vendors~index~logviewer~perf~userguide.js userguide.js
  [0] ./src/js/treeherder.js 274 bytes {3} {8} {9} [built]
  [4] ./src/js/constants.js 12.4 KiB {3} {8} {9} [built]
  [5] ./src/js/services/taskcluster.js 1.73 KiB {3} {8} {9} [built]
  [8] ./src/helpers/urlHelper.js + 2 modules 6.22 KiB {3} {8} {9} [built]
      | ./src/helpers/urlHelper.js 5.23 KiB [built]
      | ./src/helpers/locationHelper.js 220 bytes [built]
      | ./src/helpers/revisionHelper.js 789 bytes [built]
 [10] ./src/partials/main/tcjobactions.html 1.95 KiB {3} {8} {9} [built]
 [18] ./src/helpers/jobHelper.js 4.58 KiB {7} {9} [built]
 [23] ./src/js/filters.js 2.09 KiB {3} {8} {9} [built]
 [28] ./src/js/services/tcactions.js 5.8 KiB {3} {8} {9} [built]
 [37] ./src/js/services/main.js 4.59 KiB {7} {8} [built]
 [68] ./src/partials/main/intermittent.html 5.26 KiB {9} [built]
 [72] ./src/entry-userguide.js + 1 modules 515 bytes {6} [built]
      | ./src/entry-userguide.js 25 bytes [built]
      | ./src/js/userguide.js 485 bytes [built]
 [73] ./src/entry-perf.js + 2 modules 1.74 KiB {8} [built]
      | ./src/entry-perf.js 169 bytes [built]
      | ./src/js/perf.js 401 bytes [built]
      | ./src/js/models/option_collection.js 1.13 KiB [built]
 [74] ./src/entry-logviewer.js + 2 modules 11.9 KiB {7} [built]
      | ./src/entry-logviewer.js 170 bytes [built]
      | ./src/js/logviewer.js 1.11 KiB [built]
      | ./src/js/controllers/logviewer.js 10.6 KiB [built]
 [75] ./src/entry-index.js + 2 modules 31.5 KiB {9} [built]
      | ./src/entry-index.js 139 bytes [built]
      | ./src/js/treeherder_app.js 2.25 KiB [built]
      | ./src/plugins/controller.js 29 KiB [built]
[151] (webpack)/buildin/module.js 519 bytes {1} [built]
    + 146 hidden modules

WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets:
  vendors~index~logviewer~perf.js (397 KiB)

WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
  index (937 KiB)
      vendors~index~logviewer~perf~userguide.js
      vendors~index~logviewer~perf.js
      vendors~index~perf.js
      vendors~index.js
      index.js
  perf (742 KiB)
      vendors~index~logviewer~perf~userguide.js
      vendors~index~logviewer~perf.js
      vendors~index~perf.js
      vendors~perf.js
      perf.js
  logviewer (591 KiB)
      vendors~index~logviewer~perf~userguide.js
      vendors~index~logviewer~perf.js
      index~logviewer~perf.js
      logviewer.js


WARNING in webpack performance recommendations:
You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
For more info visit https://webpack.js.org/guides/code-splitting/
</code></pre></div>
</details>
<hr>
<p dir="auto"><strong>Other relevant information:</strong><br>
webpack version:  4.8.3<br>
Node.js version: 10.1.0<br>
Operating System: Windows 10<br>
Additional tools: N/A</p>
<h1 dir="auto">Bug report</h1>




<p dir="auto"><strong>What is the current behavior?</strong></p>
<p dir="auto">I am trying to use my react webpack setup on my Android system but this watcher warning annoying I don't know why it trying to watch system root directory which should not be accessible to users unless they have root access : Watchpack Error (watcher): Error: EACCES: permission denied, watch '/data/data' Watchpack Error (watcher): Error: EACCES: permission denied, watch '/data' Watchpack Error (initial scan): Error: EACCES: permission denied, scandir '/data/data' Watchpack Error (initial scan): Error: EACCES: permission denied, scandir '/data'</p>
<p dir="auto">This my project cwd where home directory is my $HOME I don't know why webpack trying to go beyond that :</p>
<p dir="auto">/data/data/com.termux/files/home/react</p>
<p dir="auto">I tried to ignore the data/ directory by adding this option in webpack config :</p>
<p dir="auto">watchOptions: { ignored: [”../../../../../../"] } But this make hot reloading stop working anyone had experienced this before I will appreciate help</p>
<p dir="auto"><strong>If the current behavior is a bug, please provide the steps to reproduce.</strong></p>






<p dir="auto">Just launch devServer it happened also with npx create-next-app<br>
<strong>What is the expected behavior?</strong></p>
<p dir="auto">No warrnigs</p>


<p dir="auto"><strong>Other relevant information:</strong><br>
webpack version:  5.57.0<br>
Node.js version: v17.4.0<br>
Operating System: Android 10<br>
Additional tools: termux terminal</p>