Skip to content

Commit

Permalink
export define and require functions
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed Jul 12, 2017
1 parent f4173fe commit a77718f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build/lib/snapshotLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion build/lib/snapshotLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace snaps {
CSSLoaderPlugin.init();
NLSLoaderPlugin.init();
return define;
return { define, require };
}
})();
`;
Expand Down
3 changes: 2 additions & 1 deletion src/vs/workbench/electron-browser/bootstrap/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit a77718f

Please sign in to comment.