mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 13:55:41 +01:00
Merge pull request #4742 from RoccoC/webpack-plugin-esm
Some checks failed
CI / CI (push) Has been cancelled
Some checks failed
CI / CI (push) Has been cancelled
Update webpack plugin to support module workers
This commit is contained in:
commit
495d075be0
2 changed files with 9 additions and 2 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "monaco-editor-webpack-plugin",
|
"name": "monaco-editor-webpack-plugin",
|
||||||
"version": "7.1.0",
|
"version": "7.1.1",
|
||||||
"description": "A webpack plugin for the Monaco Editor",
|
"description": "A webpack plugin for the Monaco Editor",
|
||||||
"main": "out/index.js",
|
"main": "out/index.js",
|
||||||
"typings": "./out/index.d.ts",
|
"typings": "./out/index.d.ts",
|
||||||
|
|
|
||||||
|
|
@ -296,7 +296,14 @@ function createLoaderRules(
|
||||||
if(/^(\\/\\/)/.test(result)) {
|
if(/^(\\/\\/)/.test(result)) {
|
||||||
result = window.location.protocol + result
|
result = window.location.protocol + result
|
||||||
}
|
}
|
||||||
var js = '/*' + label + '*/importScripts("' + result + '");';
|
var js = '/*' + label + '*/';
|
||||||
|
if (typeof import.meta !== 'undefined') {
|
||||||
|
// module worker
|
||||||
|
js += 'import "' + result + '";';
|
||||||
|
} else {
|
||||||
|
// classic worker
|
||||||
|
js += 'importScripts("' + result + '");';
|
||||||
|
}
|
||||||
var blob = new Blob([js], { type: 'application/javascript' });
|
var blob = new Blob([js], { type: 'application/javascript' });
|
||||||
return URL.createObjectURL(blob);
|
return URL.createObjectURL(blob);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue