-
Notifications
You must be signed in to change notification settings - Fork 98
Fix __webpack_public_path__ within getWorkerUrl method #63
Conversation
issue reference: #7 (comment) |
@alexandrudima sorry to bother, but i can confirm that there was an issue before this PR. this PR correctly recognize |
@alexandrudima could I bother you to take a look at this one please? 🙏 |
also /cc @TheLarkInn I know you work at Microsoft... any chance you could ping the appropriate person to get this one noticed? |
Ill do my best @mikegreiling!!! |
I had this same issue, and applied the same patch. I can confirm as well this fixes. Please merge!! |
Like @z1haze, we also can confirm, that this patch fixes the issue #7. We hope, that this PR will be merged in the near future... :) |
Need this to make monaco-editor work with Next.js 9.1.2 |
This is a workaround to make cross origin monaco web workers function in spite of the monaco webpack plugin hijacking the MonacoEnvironment global. see microsoft/monaco-editor-webpack-plugin#42 This workaround wouldn't be so bad, if it didn't _also_ rely on *another* bug to actually work. The webpack plugin incorrectly uses window.__webpack_public_path__ when it should use __webpack_public_path__ see microsoft/monaco-editor-webpack-plugin#63 We can leave __webpack_public_path__ with the correct value, which lets runtime chunk loading continue to function correctly. We can then set window.__webpack_public_path__ to the below handler, which lets us fabricate a worker on the fly. This is bad and I feel bad.
This is a workaround to make cross origin monaco web workers function in spite of the monaco webpack plugin hijacking the MonacoEnvironment global. see microsoft/monaco-editor-webpack-plugin#42 This workaround wouldn't be so bad, if it didn't _also_ rely on *another* bug to actually work. The webpack plugin incorrectly uses window.__webpack_public_path__ when it should use __webpack_public_path__ see microsoft/monaco-editor-webpack-plugin#63 We can leave __webpack_public_path__ with the correct value, which lets runtime chunk loading continue to function correctly. We can then set window.__webpack_public_path__ to the below handler, which lets us fabricate a worker on the fly. This is bad and I feel bad.
I have a fork here
You can set the if (!isServer) {
config.plugins.push(
new MonacoWebpackPlugin({
output: 'monaco/' + monacoVersion,
publicPath: '/public',
}),
);
} |
Thank you and apologies for the long waiting time! ❤️ |
Thank you, @alexdima. Any ETA when this might land in a new package release? |
According to webpack's documentation, the
__webpack_public_path__
variable is not in the global scope, but is instead a free variable provided by a closure which webpack creates when it generates its runtime wrapper.https://webpack.js.org/configuration/output/#outputpublicpath
window.__webpack_public_path__
should just be__webpack_public_path__
closes #7