Browse Source

Use PATH_PREFIX correctly in dev-setup

Alex Dima 6 years ago
parent
commit
7edb4d6f13
1 changed files with 10 additions and 8 deletions
  1. 10 8
      test/dev-setup.js

+ 10 - 8
test/dev-setup.js

@@ -55,23 +55,25 @@
 	Component.prototype.isRelease = function() {
 	Component.prototype.isRelease = function() {
 		return /release/.test(this.selectedPath);
 		return /release/.test(this.selectedPath);
 	};
 	};
-	Component.prototype.getResolvedPath = function() {
+	Component.prototype.getResolvedPath = function(PATH_PREFIX) {
 		let resolvedPath = this.paths[this.selectedPath];
 		let resolvedPath = this.paths[this.selectedPath];
 		if (this.selectedPath === 'npm/dev' || this.selectedPath === 'npm/min' || this.isRelease()) {
 		if (this.selectedPath === 'npm/dev' || this.selectedPath === 'npm/min' || this.isRelease()) {
 			if (IS_FILE_PROTOCOL) {
 			if (IS_FILE_PROTOCOL) {
 				resolvedPath = DIRNAME + '/../' + resolvedPath;
 				resolvedPath = DIRNAME + '/../' + resolvedPath;
 			} else {
 			} else {
-				resolvedPath = '/monaco-editor/' + resolvedPath;
+				resolvedPath = PATH_PREFIX + '/monaco-editor/' + resolvedPath;
 			}
 			}
 		} else {
 		} else {
 			if (IS_FILE_PROTOCOL) {
 			if (IS_FILE_PROTOCOL) {
 				resolvedPath = DIRNAME + '/../..' + resolvedPath;
 				resolvedPath = DIRNAME + '/../..' + resolvedPath;
+			} else {
+				resolvedPath = PATH_PREFIX + resolvedPath;
 			}
 			}
 		}
 		}
 		return resolvedPath;
 		return resolvedPath;
 	};
 	};
-	Component.prototype.generateLoaderConfig = function(dest) {
-		dest[this.modulePrefix] = this.getResolvedPath();
+	Component.prototype.generateLoaderConfig = function(dest, PATH_PREFIX) {
+		dest[this.modulePrefix] = this.getResolvedPath(PATH_PREFIX);
 	};
 	};
 	Component.prototype.generateUrlForPath = function(pathName) {
 	Component.prototype.generateUrlForPath = function(pathName) {
 		let NEW_LOADER_OPTS = {};
 		let NEW_LOADER_OPTS = {};
@@ -103,7 +105,7 @@
 
 
 
 
 	let RESOLVED_CORE = new Component('editor', 'vs', METADATA.CORE.paths);
 	let RESOLVED_CORE = new Component('editor', 'vs', METADATA.CORE.paths);
-	self.RESOLVED_CORE_PATH = RESOLVED_CORE.getResolvedPath();
+	self.RESOLVED_CORE_PATH = RESOLVED_CORE.getResolvedPath('');
 	let RESOLVED_PLUGINS = METADATA.PLUGINS.map(function(plugin) {
 	let RESOLVED_PLUGINS = METADATA.PLUGINS.map(function(plugin) {
 		return new Component(plugin.name, plugin.modulePrefix, plugin.paths, plugin.contrib);
 		return new Component(plugin.name, plugin.modulePrefix, plugin.paths, plugin.contrib);
 	});
 	});
@@ -151,14 +153,14 @@
 	self.loadEditor = function(callback, PATH_PREFIX) {
 	self.loadEditor = function(callback, PATH_PREFIX) {
 		PATH_PREFIX = PATH_PREFIX || '';
 		PATH_PREFIX = PATH_PREFIX || '';
 
 
-		loadScript(PATH_PREFIX + RESOLVED_CORE.getResolvedPath() + '/loader.js', function() {
+		loadScript(RESOLVED_CORE.getResolvedPath(PATH_PREFIX) + '/loader.js', function() {
 			let loaderPathsConfig = {};
 			let loaderPathsConfig = {};
 			if (!RESOLVED_CORE.isRelease()) {
 			if (!RESOLVED_CORE.isRelease()) {
 				RESOLVED_PLUGINS.forEach(function(plugin) {
 				RESOLVED_PLUGINS.forEach(function(plugin) {
-					plugin.generateLoaderConfig(loaderPathsConfig);
+					plugin.generateLoaderConfig(loaderPathsConfig, PATH_PREFIX);
 				});
 				});
 			}
 			}
-			RESOLVED_CORE.generateLoaderConfig(loaderPathsConfig);
+			RESOLVED_CORE.generateLoaderConfig(loaderPathsConfig, PATH_PREFIX);
 
 
 			console.log('LOADER CONFIG: ');
 			console.log('LOADER CONFIG: ');
 			console.log(JSON.stringify(loaderPathsConfig, null, '\t'));
 			console.log(JSON.stringify(loaderPathsConfig, null, '\t'));