export define and require functions
This commit is contained in:
parent
f4173fe59d
commit
a77718ff60
3 changed files with 4 additions and 3 deletions
|
@ -30,7 +30,7 @@ var snaps;
|
|||
snapshotLoader(loaderFilepath, startupBlobFilepath);
|
||||
function snapshotLoader(loaderFilepath, startupBlobFilepath) {
|
||||
var inputFile = fs.readFileSync(loaderFilepath);
|
||||
var wrappedInputFile = "\n\t\tvar Monaco_Loader_Init;\n\t\t(function() {\n\t\t\tvar doNotInitLoader = true;\n\t\t\t" + inputFile.toString() + ";\n\t\t\tMonaco_Loader_Init = function() {\n\t\t\t\tAMDLoader.init();\n\t\t\t\tCSSLoaderPlugin.init();\n\t\t\t\tNLSLoaderPlugin.init();\n\n\t\t\t\treturn define;\n\t\t\t}\n\t\t})();\n\t\t";
|
||||
var wrappedInputFile = "\n\t\tvar Monaco_Loader_Init;\n\t\t(function() {\n\t\t\tvar doNotInitLoader = true;\n\t\t\t" + inputFile.toString() + ";\n\t\t\tMonaco_Loader_Init = function() {\n\t\t\t\tAMDLoader.init();\n\t\t\t\tCSSLoaderPlugin.init();\n\t\t\t\tNLSLoaderPlugin.init();\n\n\t\t\t\treturn { define, require };\n\t\t\t}\n\t\t})();\n\t\t";
|
||||
var wrappedInputFilepath = path.join(os.tmpdir(), 'wrapped-loader.js');
|
||||
console.log(wrappedInputFilepath);
|
||||
fs.writeFileSync(wrappedInputFilepath, wrappedInputFile);
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace snaps {
|
|||
CSSLoaderPlugin.init();
|
||||
NLSLoaderPlugin.init();
|
||||
|
||||
return define;
|
||||
return { define, require };
|
||||
}
|
||||
})();
|
||||
`;
|
||||
|
|
|
@ -214,8 +214,9 @@ function main() {
|
|||
// loads as soon as the loader loads. To be able to have pseudo translation
|
||||
const loaderTimer = startTimer('load:loader');
|
||||
if (typeof Monaco_Loader_Init === 'function') {
|
||||
const loader = Monaco_Loader_Init();
|
||||
//eslint-disable-next-line no-global-assign
|
||||
define = Monaco_Loader_Init();
|
||||
define = loader.define; require = loader.require;
|
||||
onLoader();
|
||||
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue