wails icon indicating copy to clipboard operation
wails copied to clipboard

Ignore frontend rebuild if go files updated in dev

Open leaanthony opened this issue 3 years ago • 8 comments

Should not rebuild frontend project if .go file was updated in dev mode

leaanthony avatar Jan 12 '22 10:01 leaanthony

@Ironpark - Please test this as a fix for #1031

leaanthony avatar Jan 12 '22 10:01 leaanthony

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: e16457b
Status: ✅  Deploy successful!
Preview URL: https://0ef95c37.wails-website.pages.dev

View logs

@Ironpark any feedback?

leaanthony avatar Jan 17 '22 09:01 leaanthony

@leaanthony

if _, exists := extensionsThatTriggerARebuild[ext]; exists {
    rebuild = true
    ignoreFrontend = strings.HasSuffix(ext, "go")
    timer.Reset(interval)
    continue
}

If you modify the 'go' code before rebuilding after modifying the frontend code, the frontend build doesn't seem to work.

It is suggested to modify it as follows.

if _, exists := extensionsThatTriggerARebuild[ext]; exists {
    rebuild = true
-    ignoreFrontend = strings.HasSuffix(ext, "go")
+    buildFrontend = !strings.HasSuffix(ext, "go")
    timer.Reset(interval)
    continue
}
//
rebuild = false
- buildOptions.IgnoreFrontend = ignoreFrontend
+ buildOptions.IgnoreFrontend = !buildFrontend
+ buildFrontend = false

ironpark avatar Jan 23 '22 20:01 ironpark

Also, since the default flag setting only processes files with the go extension, if you apply the patch, the frontend will not be built at all unless you set a separate flag.

Therefore, it would be better to add css, html, js, and jsx, which are often used in front-end development, to the default value of the extensions flag.

Maybe it would be nice to add ts, tsx, scss etc as well.

func defaultDevFlags() devFlags {
	return devFlags{
		devServerURL:    defaultDevServerURL,
		compilerCommand: "go",
		verbosity:       1,
-		extensions:      "go",
+		extensions:      "go,js,jsx,html,css",
		debounceMS:      100,
	}
}

ironpark avatar Jan 23 '22 20:01 ironpark

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar May 01 '22 03:05 stale[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 10 '22 09:07 stale[bot]

@Ironpark - I think this is basically redundant now that we are using Vite? Thoughts?

leaanthony avatar Jul 10 '22 10:07 leaanthony