mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 11:35:40 +01:00
this is more inline with webpack https://webpack.js.org/concepts/output/\#advanced
This commit is contained in:
parent
f1ea23c229
commit
44bfaed10e
1 changed files with 2 additions and 18 deletions
20
index.js
20
index.js
|
|
@ -96,25 +96,9 @@ function createLoaderRules(languages, features, workers, publicPath) {
|
|||
}), {});
|
||||
|
||||
const getWorkerPath = (workerPath) => {
|
||||
const getBasePath = () => {
|
||||
const bases = document.getElementsByTagName('base');
|
||||
let contextPath = '/';
|
||||
if (bases.length) {
|
||||
contextPath = bases[0].getAttribute('context') || bases[0].href || '/';
|
||||
}
|
||||
return contextPath;
|
||||
};
|
||||
|
||||
const basePath = getBasePath();
|
||||
if (basePath[basePath.length - 1] !== '/') {
|
||||
basePath = `${basePath}/`;
|
||||
if(!publicPath && window.__webpack_public_path__) {
|
||||
return `${window.__webpack_public_path__}/${workerPath}`
|
||||
}
|
||||
if (workerPath[0] === '/') {
|
||||
workerPath = workerPath.substr(1);
|
||||
}
|
||||
|
||||
const contextPath = basePath + workerPath;
|
||||
return contextPath;
|
||||
};
|
||||
|
||||
const globals = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue