diff --git a/v2/cmd/wails/internal/commands/dev/dev.go b/v2/cmd/wails/internal/commands/dev/dev.go index 0095273e..e96c2409 100644 --- a/v2/cmd/wails/internal/commands/dev/dev.go +++ b/v2/cmd/wails/internal/commands/dev/dev.go @@ -198,8 +198,9 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error { } // frontend:dev:watcher command. + frontendDevAutoDiscovery := projectConfig.IsFrontendDevServerURLAutoDiscovery() if command := projectConfig.DevWatcherCommand; command != "" { - closer, devServerURL, err := runFrontendDevWatcherCommand(cwd, command, projectConfig.FrontendDevServerURL == "auto") + closer, devServerURL, err := runFrontendDevWatcherCommand(cwd, command, frontendDevAutoDiscovery) if err != nil { return err } @@ -208,6 +209,8 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error { flags.frontendDevServerURL = devServerURL } defer closer() + } else if frontendDevAutoDiscovery { + return fmt.Errorf("Unable to auto discover frontend:dev:serverUrl without a frontend:dev:watcher command, please either set frontend:dev:watcher or remove the auto discovery from frontend:dev:serverUrl") } // Do initial build but only for the application. diff --git a/v2/internal/project/project.go b/v2/internal/project/project.go index 136abd8a..0deab17f 100644 --- a/v2/internal/project/project.go +++ b/v2/internal/project/project.go @@ -103,6 +103,10 @@ func (p *Project) GetDevInstallerCommand() string { return p.InstallCommand } +func (p *Project) IsFrontendDevServerURLAutoDiscovery() bool { + return p.FrontendDevServerURL == "auto" +} + func (p *Project) Save() error { data, err := json.MarshalIndent(p, "", " ") if err != nil {