Skip to content

Commit

Permalink
add --inline-client command option to customize inline client URL for…
Browse files Browse the repository at this point in the history
… livereload in webpack-dev-server
  • Loading branch information
elclanrs committed Dec 4, 2016
1 parent 457a6e0 commit 0223193
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions packages/angular-cli/commands/serve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export interface ServeTaskOptions {
open?: boolean;
vendorChunk?: boolean;
hmr?: boolean;
inlineClient?: string;
}

const ServeCommand = Command.extend({
Expand Down Expand Up @@ -103,6 +104,12 @@ const ServeCommand = Command.extend({
default: false,
description: 'Enable hot module replacement',
},
{
name: 'inline-client',
type: String,
aliases: ['ic'],
description: '(Defaults to "http://host:port")'
}
],

run: function(commandOptions: ServeTaskOptions) {
Expand All @@ -117,6 +124,9 @@ const ServeCommand = Command.extend({

commandOptions.liveReloadHost = commandOptions.liveReloadHost || commandOptions.host;

commandOptions.inlineClient = commandOptions.inlineClient ||
`http://${commandOptions.host}:${commandOptions.port}/`;

return this._checkExpressPort(commandOptions)
.then(this._autoFindLiveReloadPort.bind(this))
.then((opts: ServeTaskOptions) => {
Expand Down
3 changes: 2 additions & 1 deletion packages/angular-cli/tasks/serve-webpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ export default Task.extend({
// This allows for live reload of page when changes are made to repo.
// https://webpack.github.io/docs/webpack-dev-server.html#inline-mode
let entryPoints = [
`webpack-dev-server/client?http://${serveTaskOptions.host}:${serveTaskOptions.port}/`
`webpack-dev-server/client?${serveTaskOptions.inlineClient}/`
];

if (serveTaskOptions.hmr) {
const webpackHmrLink = 'https://webpack.github.io/docs/hot-module-replacement.html';
ui.writeLine(oneLine`
Expand Down

0 comments on commit 0223193

Please sign in to comment.