Skip to content
Merged
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
5 changes: 5 additions & 0 deletions messages/webapp.dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@ Failed to watch manifest: %s
Dev server unreachable at %s.
Start your dev server manually at that URL, or add dev.command to webapplication.json to start it automatically.

# error.dev-url-unreachable-with-flag

Dev server unreachable at %s.
Remove --url to use dev.command to start the server automatically, or ensure your dev server is running at that URL.

# error.port-in-use

Port %s is already in use. Try specifying a different port with the --port flag or stopping the service that's using the port.
Expand Down
11 changes: 9 additions & 2 deletions src/commands/webapp/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,15 @@ export default class WebappDev extends SfCommand<WebAppDevResult> {
devServerUrl = resolvedUrl;
this.log(messages.getMessage('info.url-already-available', [resolvedUrl]));
this.logger.debug(`URL ${resolvedUrl} is reachable, skipping dev server startup`);
} else if ((flags.url ?? manifest?.dev?.url) && !manifest?.dev?.command?.trim()) {
// Explicit URL (--url or dev.url) but no dev.command - don't start (we can't control the port)
} else if (flags.url) {
// User explicitly passed --url; assume server is already running at that URL
// Fail immediately if unreachable (don't start dev server)
throw new SfError(messages.getMessage('error.dev-url-unreachable-with-flag', [resolvedUrl]), 'DevServerUrlError', [
`Ensure your dev server is running at ${resolvedUrl}`,
'Remove --url to use dev.command to start the server automatically',
]);
} else if (manifest?.dev?.url && !manifest?.dev?.command?.trim()) {
// dev.url in manifest but no dev.command - don't start (we can't control the port)
throw new SfError(messages.getMessage('error.dev-url-unreachable', [resolvedUrl]), 'DevServerUrlError', [
`Ensure your dev server is running at ${resolvedUrl}`,
'Or add dev.command to webapplication.json to start it automatically',
Expand Down