build/lib/bundle.ts/resolvePath
export function bundle(entryPoints: IEntryPoint[], config: ILoaderConfig, callback: (err: any, result: IBundleResult | null) => void): void {
	const entryPointsMap: IEntryPointMap = {};
	entryPoints.forEach((module: IEntryPoint) => {
		if (entryPointsMap[module.name]) {
			throw new Error(`Cannot have two entry points with the same name '${module.name}'`);
		}
		entryPointsMap[module.name] = module;
	});

	const allMentionedModulesMap: { [modules: string]: boolean } = {};
	entryPoints.forEach((module: IEntryPoint) => {
		allMentionedModulesMap[module.name] = true;
		module.include?.forEach(function (includedModule) {
			allMentionedModulesMap[includedModule] = true;
		});
		module.exclude?.forEach(function (excludedModule) {
			allMentionedModulesMap[excludedModule] = true;
		});
	});


	const code = require('fs').readFileSync(path.join(__dirname, '../../src/vs/loader.js'));
	const r: Function = <any>vm.runInThisContext('(function(require, module, exports) { ' + code + '\n});');
	const loaderModule = { exports: {} };
	r.call({}, require, loaderModule, loaderModule.exports);

	const loader: any = loaderModule.exports;
	config.isBuild = true;
	config.paths = config.paths || {};
	if (!config.paths['vs/nls']) {
		config.paths['vs/nls'] = 'out-build/vs/nls.build';
	}
	if (!config.paths['vs/css']) {
		config.paths['vs/css'] = 'out-build/vs/css.build';
	}
	config.buildForceInvokeFactory = config.buildForceInvokeFactory || {};
	config.buildForceInvokeFactory['vs/nls'] = true;
	config.buildForceInvokeFactory['vs/css'] = true;
	loader.config(config);

	loader(['require'], (localRequire: any) => {
		const resolvePath = (entry: IExtraFile) => {
			let r = localRequire.toUrl(entry.path);
			if (!r.endsWith('.js')) {
				r += '.js';
			}
			// avoid packaging the build version of plugins:
			r = r.replace('vs/nls.build.js', 'vs/nls.js');
			r = r.replace('vs/css.build.js', 'vs/css.js');
			return { path: r, amdModuleId: entry.amdModuleId };
		};
		for (const moduleId in entryPointsMap) {
			const entryPoint = entryPointsMap[moduleId];
			if (entryPoint.append) {
				entryPoint.append = entryPoint.append.map(resolvePath);
			}
			if (entryPoint.prepend) {
				entryPoint.prepend = entryPoint.prepend.map(resolvePath);
			}
		}
	});

	loader(Object.keys(allMentionedModulesMap), () => {
		const modules = <IBuildModuleInfo[]>loader.getBuildInfo();
		const partialResult = emitEntryPoints(modules, entryPointsMap);
		const cssInlinedResources = loader('vs/css').getInlinedResources();
		callback(null, {
			files: partialResult.files,
			cssInlinedResources: cssInlinedResources,
			bundleData: partialResult.bundleData
		});
	}, (err: any) => callback(err, null));
}