Skip to content

feat(serve): add ability to set websocket client URL for wp-dev-server #3873

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/angular-cli/commands/serve.run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export default function serveRun(commandOptions: ServeTaskOptions) {
// Check angular version.
Version.assertAngularVersionIs2_3_1OrHigher(this.project.root);
commandOptions.liveReloadHost = commandOptions.liveReloadHost || commandOptions.host;
commandOptions.public = commandOptions.public || `http://${commandOptions.host}:${commandOptions.port}`;

return checkExpressPort(commandOptions)
.then(() => autoFindLiveReloadPort(commandOptions))
Expand Down
10 changes: 9 additions & 1 deletion packages/angular-cli/commands/serve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export interface ServeTaskOptions {
i18nFormat?: string;
locale?: string;
extractCss?: boolean | null;
public?: string;
}

const ServeCommand = Command.extend({
Expand Down Expand Up @@ -105,7 +106,14 @@ const ServeCommand = Command.extend({
{ name: 'i18n-file', type: String, default: null },
{ name: 'i18n-format', type: String, default: null },
{ name: 'locale', type: String, default: null },
{ name: 'extract-css', type: Boolean, default: null }
{ name: 'extract-css', type: Boolean, default: null },
{ name: 'locale', type: String, default: null },
{
name: 'public',
type: String,
default: '',
description: 'Websocket client URL for webpack-dev-server inline client'
}
],

run: function(commandOptions: ServeTaskOptions) {
Expand Down
2 changes: 1 addition & 1 deletion packages/angular-cli/tasks/serve-webpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ 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.public}/`
];
if (serveTaskOptions.hmr) {
const webpackHmrLink = 'https://webpack.github.io/docs/hot-module-replacement.html';
Expand Down