mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 17:25:39 +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 getWorkerPath = (workerPath) => {
|
||||||
const getBasePath = () => {
|
if(!publicPath && window.__webpack_public_path__) {
|
||||||
const bases = document.getElementsByTagName('base');
|
return `${window.__webpack_public_path__}/${workerPath}`
|
||||||
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 (workerPath[0] === '/') {
|
|
||||||
workerPath = workerPath.substr(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
const contextPath = basePath + workerPath;
|
|
||||||
return contextPath;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const globals = {
|
const globals = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue