解决 sdk 版本 monaco-editor 加载报错的问题

Change-Id: Ie8892fbce87221cab715791132fc0433953405bd
This commit is contained in:
2betop 2020-11-17 17:05:53 +08:00
parent 12be84bd61
commit 80653ec51f
3 changed files with 11 additions and 4 deletions

View File

@ -33,6 +33,9 @@ function onLoad(req: any, callback: (result: any) => void) {
'vs/base/worker/workerMain': __uri( 'vs/base/worker/workerMain': __uri(
'monaco-editor/min/vs/base/worker/workerMain.js' 'monaco-editor/min/vs/base/worker/workerMain.js'
), ),
'vs/base/browser/ui/codicons/codicon/codicon.ttf': __uri(
'monaco-editor/min/vs/base/browser/ui/codicons/codicon/codicon.ttf'
),
'vs/basic-languages/apex/apex': __uri( 'vs/basic-languages/apex/apex': __uri(
'monaco-editor/min/vs/basic-languages/apex/apex' 'monaco-editor/min/vs/basic-languages/apex/apex'
), ),
@ -204,7 +207,7 @@ function onLoad(req: any, callback: (result: any) => void) {
), ),
'vs/language/css/cssWorker': __uri( 'vs/language/css/cssWorker': __uri(
'monaco-editor/min/vs/language/css/cssWorker.js' 'monaco-editor/min/vs/language/css/cssWorker.js'
) ),
} }
}; };
Object.keys(config.paths).forEach((key: keyof typeof config.paths) => { Object.keys(config.paths).forEach((key: keyof typeof config.paths) => {
@ -220,9 +223,9 @@ function onLoad(req: any, callback: (result: any) => void) {
baseUrl: '${config.paths.vs}', baseUrl: '${config.paths.vs}',
paths: ${JSON.stringify(config.paths)} paths: ${JSON.stringify(config.paths)}
}; };
importScripts('${__uri( importScripts('${filterUrl(__uri(
'monaco-editor/min/vs/base/worker/workerMain.js' 'monaco-editor/min/vs/base/worker/workerMain.js'
)}');`)}`; ))}');`)}`;
} }
}; };
} else { } else {

View File

@ -439,6 +439,10 @@ if (fis.project.currentMedia() === 'publish') {
optimizer: null optimizer: null
}); });
env.match('monaco-editor/**.css', {
standard: false
});
fis.on('compile:optimizer', function (file) { fis.on('compile:optimizer', function (file) {
if (file.isJsLike && file.isMod) { if (file.isJsLike && file.isMod) {
var contents = file.getContent(); var contents = file.getContent();

View File

@ -132,6 +132,7 @@ module.exports = function (ret, pack, settings, opt) {
} catch (e) { } catch (e) {
d = (/((?:https?|file)\:.*)$/.test(e.stack) ? RegExp.$1 : '').replace(/\\/[^\\/]*$/, ''); d = (/((?:https?|file)\:.*)$/.test(e.stack) ? RegExp.$1 : '').replace(/\\/[^\\/]*$/, '');
} }
amis.host = d;
${contents.replace(/\"url\"\s*\:\s*('|")(\.\/.*)\1/g, function ( ${contents.replace(/\"url\"\s*\:\s*('|")(\.\/.*)\1/g, function (
_, _,
quote, quote,
@ -141,7 +142,6 @@ module.exports = function (ret, pack, settings, opt) {
})} })}
})()`; })()`;
} }
jsContents += contents + ';\n'; jsContents += contents + ';\n';
} }
} else if ( } else if (