From 1086582fe807568164ded93d0f5b84a9d767cbbf Mon Sep 17 00:00:00 2001 From: Rob Eisenberg Date: Wed, 13 Jul 2016 17:18:49 -0400 Subject: [PATCH] fix(aspnet): correctly configure base url Fixes #173 --- lib/build/bundle.js | 3 ++- lib/build/bundler.js | 2 +- lib/commands/new/new-application.json | 10 +++++----- lib/commands/new/platforms/{default.js => web.js} | 0 lib/commands/new/project-template.js | 4 ++++ 5 files changed, 12 insertions(+), 7 deletions(-) rename lib/commands/new/platforms/{default.js => web.js} (100%) diff --git a/lib/build/bundle.js b/lib/build/bundle.js index 93af8cde1..c35a588b9 100644 --- a/lib/build/bundle.js +++ b/lib/build/bundle.js @@ -194,6 +194,7 @@ exports.Bundle = class { let bundleMetadata = {}; let includeBundles = shouldIncludeBundleMetadata(bundles, loaderOptions); let config = Object.assign({}, loaderConfig); + let location = platform.baseUrl || platform.output; for (let i = 0; i < bundles.length; ++i) { let currentBundle = bundles[i]; @@ -207,7 +208,7 @@ exports.Bundle = class { bundleMetadata[currentBundle.moduleId] = currentBundle.getBundledModuleIds(); } - config.paths[currentBundle.moduleId] = '../' + platform.output + '/' + currentBundle.moduleId; + config.paths[currentBundle.moduleId] = '../' + location + '/' + currentBundle.moduleId; } if (includeBundles) { diff --git a/lib/build/bundler.js b/lib/build/bundler.js index 54b56f106..987b6c173 100644 --- a/lib/build/bundler.js +++ b/lib/build/bundler.js @@ -24,7 +24,7 @@ exports.Bundler = class { this.loaderOptions = project.build.loader; this.loaderConfig = { - baseUrl: this.loaderOptions.baseUrl || project.paths.root, + baseUrl: project.paths.root, paths: {}, packages: [], stubModules: [] diff --git a/lib/commands/new/new-application.json b/lib/commands/new/new-application.json index dc7f11562..255afdd20 100644 --- a/lib/commands/new/new-application.json +++ b/lib/commands/new/new-application.json @@ -35,8 +35,8 @@ "displayName": "Visual Studio Code" }, "platform": { - "id": "default", - "displayName": "Default" + "id": "web", + "displayName": "Web" } } }, @@ -99,11 +99,11 @@ "stateProperty": "platform", "options": [ { - "displayName": "Default", + "displayName": "Web", "description": "The default web platform setup.", "value": { - "id": "default", - "displayName": "Default" + "id": "web", + "displayName": "Web" } }, { diff --git a/lib/commands/new/platforms/default.js b/lib/commands/new/platforms/web.js similarity index 100% rename from lib/commands/new/platforms/default.js rename to lib/commands/new/platforms/web.js diff --git a/lib/commands/new/project-template.js b/lib/commands/new/project-template.js index 080012615..f68f7cc6e 100644 --- a/lib/commands/new/project-template.js +++ b/lib/commands/new/project-template.js @@ -261,6 +261,10 @@ exports.ProjectTemplate = class { this.model.cssProcessor.source = path.join(appRoot, '**/*' + this.model.cssProcessor.fileExtension); this.model.platform.output = scriptsLocation; + if (this.model.platform.id === 'aspnetcore') { + this.model.platform.baseUrl = this.scripts.calculateRelativePath(this.scripts.parent) + } + if (this.unitTests.parent) { this.model.unitTestRunner.source = path.join( this.unitTests.calculateRelativePath(this.projectFolder.parent),