Fix broken web workers when using CDN
What does this MR do?
In order to work around web workers same-origin policy, we must override the CDN settings on pages which utilize web workers. The is done by overriding __webpack_public_path__
which sets the base path for all dynamically loaded javascript assets at runtime.
The monaco-editor-webpack-plugin has a bug in which it tries to reference this path in the global scope (window.__webpack_public_path__
) instead of as a free variable (__webpack_public_path__
) – see https://github.com/Microsoft/monaco-editor-webpack-plugin/pull/63 . In !26015 (merged) we edited our workaround to set the globally scoped variable to fix the IDE, but this in turn broke our non-monaco web workers which were relying on the old behavior.
This MR reverts the changes in !26015 (merged) by removing the deleted lines and adding a note above our workaround line for the monaco plugin so that we can remove it once the bug is fixed upstream.
Original Description:
__webpack_public_path__
must be a "free variable" according to the documentation. It does not exist on the global scope, and setting window.__webpack_public_path__
will have no effect.
Effectively this change disabled the setting of __webpack_public_path__
prior to loading the IDE assets. If doing so managed to fix the issue, we ought to be explicit about it and just remove the line altogether. However I believe that will introduce other problems, as the reason it was here in the first place was to ensure the web worker scripts bypass CDN settings since they do not work cross-origin. I suggest reverting for now and re-forming a new solution.
What are the relevant issue numbers?
Re-opens #50451 (closed)
Closes: gitlab-org/gitlab-ce#60217