From f8981185d9372034b2169b5adf9c2305713efb3d Mon Sep 17 00:00:00 2001 From: Tobias Rundbom Date: Wed, 6 Jul 2016 11:25:49 +0200 Subject: [PATCH] Makes it possible to use absolute paths for publicPath in weback.config (#161) - Parses publicPath as an URL and returns the path of that URL to be able to cope with absolute URLs --- .../npm/aspnet-webpack/src/WebpackDevMiddleware.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.AspNetCore.SpaServices/npm/aspnet-webpack/src/WebpackDevMiddleware.ts b/src/Microsoft.AspNetCore.SpaServices/npm/aspnet-webpack/src/WebpackDevMiddleware.ts index d7717d3..cef40e0 100644 --- a/src/Microsoft.AspNetCore.SpaServices/npm/aspnet-webpack/src/WebpackDevMiddleware.ts +++ b/src/Microsoft.AspNetCore.SpaServices/npm/aspnet-webpack/src/WebpackDevMiddleware.ts @@ -1,5 +1,6 @@ import * as connect from 'connect'; import * as webpack from 'webpack'; +import * as url from 'url' import { requireNewCopy } from './RequireNewCopy'; export interface CreateDevServerCallback { @@ -84,7 +85,7 @@ export function createWebpackDevServer(callback: CreateDevServerCallback, option // Tell the ASP.NET app what addresses we're listening on, so that it can proxy requests here callback(null, { Port: listener.address().port, - PublicPath: removeTrailingSlash(publicPath) + PublicPath: removeTrailingSlash(getPath(publicPath)) }); }); } @@ -96,3 +97,7 @@ function removeTrailingSlash(str: string) { return str; } + +function getPath(publicPath: string){ + return url.parse(publicPath).path; +} \ No newline at end of file