Skip to content

Commit f898118

Browse files
tobiasrSteveSandersonMS
authored andcommitted
Makes it possible to use absolute paths for publicPath in weback.config (aspnet#161)
- Parses publicPath as an URL and returns the path of that URL to be able to cope with absolute URLs
1 parent 9215ee3 commit f898118

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/Microsoft.AspNetCore.SpaServices/npm/aspnet-webpack/src/WebpackDevMiddleware.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as connect from 'connect';
22
import * as webpack from 'webpack';
3+
import * as url from 'url'
34
import { requireNewCopy } from './RequireNewCopy';
45

56
export interface CreateDevServerCallback {
@@ -84,7 +85,7 @@ export function createWebpackDevServer(callback: CreateDevServerCallback, option
8485
// Tell the ASP.NET app what addresses we're listening on, so that it can proxy requests here
8586
callback(null, {
8687
Port: listener.address().port,
87-
PublicPath: removeTrailingSlash(publicPath)
88+
PublicPath: removeTrailingSlash(getPath(publicPath))
8889
});
8990
});
9091
}
@@ -96,3 +97,7 @@ function removeTrailingSlash(str: string) {
9697

9798
return str;
9899
}
100+
101+
function getPath(publicPath: string){
102+
return url.parse(publicPath).path;
103+
}

0 commit comments

Comments
 (0)