-
Mark Florian authored
Sometimes, when trying to view a page which prefetches monaco, like viewing a snippet or the WebIDE, this error would be displayed: Can’t find entry point ‘monaco’ in webpack manifest This was happening because: 1. Incremental webpack compilation is enabled by default, meaning that only a subset of all possible chunks are compiled. 2. The monaco chunk is only split out if two or more chunks depend on it. (See [minChunks]). So, if the user doesn't have two or more chunks in their webpack compilation history (likely, especially on fresh installs), the monaco chunk isn't split out, so it's not listed as a chunk in the manifest, causing the prefetch to fail. The fix is to ignore AssetMissingErrors in the prefetch function when the webpack dev server is being used in development or test environments, where incremental compilation may be enabled. This is done to mitigate this problem occuring due to potentially other chunks not getting split out for a similar reason. An earlier iteration of this fix also reduced `optimization.splitChunks.cacheGroups.monaco.minChunks` option in `webpack.config.js` from 2 to 1, to make sure the monaco chunk was always produced. However, that had the side-effect of inflating the size of various entry points, so was reverted. See the [MR] for more details. [MR]: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/78202
ec6a2a3b