Skip to content

Commit 6b277ea

Browse files
committed
add --inline-client command option to customize inline client URL for livereload in webpack-dev-server
1 parent 123f74d commit 6b277ea

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

packages/angular-cli/commands/serve.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export interface ServeTaskOptions {
3636
i18nFile?: string;
3737
i18nFormat?: string;
3838
locale?: string;
39+
inlineClient?: string;
3940
}
4041

4142
const ServeCommand = Command.extend({
@@ -109,7 +110,13 @@ const ServeCommand = Command.extend({
109110
},
110111
{ name: 'i18n-file', type: String, default: null },
111112
{ name: 'i18n-format', type: String, default: null },
112-
{ name: 'locale', type: String, default: null }
113+
{ name: 'locale', type: String, default: null },
114+
{
115+
name: 'inline-client',
116+
type: String,
117+
aliases: ['ic'],
118+
description: 'Websocket client URL for Webpack inline mode (Defaults to "http://host:port")'
119+
}
113120
],
114121

115122
run: function(commandOptions: ServeTaskOptions) {
@@ -126,6 +133,9 @@ const ServeCommand = Command.extend({
126133
Version.assertAngularVersionIs2_3_1OrHigher(this.project.root);
127134
commandOptions.liveReloadHost = commandOptions.liveReloadHost || commandOptions.host;
128135

136+
commandOptions.inlineClient = commandOptions.inlineClient ||
137+
`http://${commandOptions.host}:${commandOptions.port}/`;
138+
129139
return this._checkExpressPort(commandOptions)
130140
.then(this._autoFindLiveReloadPort.bind(this))
131141
.then((opts: ServeTaskOptions) => {

packages/angular-cli/tasks/serve-webpack.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ export default Task.extend({
3838
// This allows for live reload of page when changes are made to repo.
3939
// https://webpack.github.io/docs/webpack-dev-server.html#inline-mode
4040
let entryPoints = [
41-
`webpack-dev-server/client?http://${serveTaskOptions.host}:${serveTaskOptions.port}/`
41+
`webpack-dev-server/client?${serveTaskOptions.inlineClient}/`
4242
];
43+
4344
if (serveTaskOptions.hmr) {
4445
const webpackHmrLink = 'https://webpack.github.io/docs/hot-module-replacement.html';
4546
ui.writeLine(oneLine`

0 commit comments

Comments
 (0)