Skip to content

Commit 8b64705

Browse files
committed
Frontend builds now use vite environment "development" or "production" depending on build type
Fix windows webview2 bootstrapper path issue
1 parent 10002d8 commit 8b64705

File tree

25 files changed

+64
-32
lines changed

25 files changed

+64
-32
lines changed

docs/src/content/docs/changelog.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5656
- Common taskfile now defaults to generating Typescript bindings for Typescript templates by [@leaanthony](https://github.com/leaanthony)
5757
- Fix Close application on WM_CLOSE message when no windows are open/systray only by [@mmalcek](https://github.com/mmalcek) in [#3990](https://github.com/wailsapp/wails/pull/3990)
5858
- Fixed garble build by @5aaee9 in [#3192](https://github.com/wailsapp/wails/pull/3192)
59+
- Fixed windows nsis builds by [@leaanthony](https://github.com/leaanthony)
5960

6061

6162
### Changed
@@ -68,6 +69,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6869
- [Windows] Reduced flicker when opening a window by [@leaanthony](https://github.com/leaanthony)
6970
- Removed `Window.Destroy` as this was intended to be an internal function by [@leaanthony](https://github.com/leaanthony)
7071
- Renamed `WindowClose` events to `WindowClosing` by [@leaanthony](https://github.com/leaanthony)
72+
- Frontend builds now use vite environment "development" or "production" depending on build type by [@leaanthony](https://github.com/leaanthony)
7173

7274
## v3.0.0-alpha.8.3 - 2024-12-07
7375

v3/internal/commands/build_assets/Taskfile.tmpl.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ tasks:
44
go:mod:tidy:
55
summary: Runs `go mod tidy`
66
internal: true
7-
generates:
8-
- go.sum
9-
sources:
10-
- go.mod
117
cmds:
128
- go mod tidy
139

@@ -36,10 +32,17 @@ tasks:
3632
- task: install:frontend:deps
3733
- task: generate:bindings
3834
cmds:
39-
- npm run build -q
35+
- npm run {{ "{{.BUILD_COMMAND}}" }} -q
36+
env:
37+
PRODUCTION: {{ "'{{.PRODUCTION | default \"false\"}}'" }}
38+
vars:
39+
BUILD_COMMAND: {{ "'{{if eq .PRODUCTION \"true\"}}build{{else}}build:dev{{end}}'" }}
40+
4041

4142
generate:bindings:
4243
summary: Generates bindings for the frontend
44+
deps:
45+
- task: go:mod:tidy
4346
sources:
4447
- "**/*.go"
4548
- go.mod

v3/internal/commands/build_assets/windows/Taskfile.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ tasks:
99
deps:
1010
- task: common:go:mod:tidy
1111
- task: common:build:frontend
12+
vars:
13+
PRODUCTION: '{{.PRODUCTION}}'
1214
- task: common:generate:icons
1315
cmds:
1416
- task: generate:syso
@@ -47,7 +49,7 @@ tasks:
4749
PRODUCTION: "true"
4850
cmds:
4951
# Create the Microsoft WebView2 bootstrapper if it doesn't exist
50-
- wails3 generate webview2bootstrapper -dir {{.ROOT_DIR}}/build/windows/nsis
52+
- wails3 generate webview2bootstrapper -dir "{{.ROOT_DIR}}\build\windows\nsis"
5153
- makensis -DARG_WAILS_{{.ARG_FLAG}}_BINARY="{{.ROOT_DIR}}\{{.BIN_DIR}}\{{.APP_NAME}}.exe" project.nsi
5254
vars:
5355
ARCH: '{{.ARCH | default ARCH}}'

v3/internal/commands/generate_webview2.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,14 @@ import (
1212
var webview2Bootstrapper []byte
1313

1414
type GenerateWebView2Options struct {
15-
Directory string `json:"directory"`
15+
Directory string `name:"dir" json:"directory"`
1616
}
1717

1818
func GenerateWebView2Bootstrapper(options *GenerateWebView2Options) error {
19+
println("options.Directory", options.Directory)
20+
options.Directory = filepath.Clean(options.Directory)
21+
println("cleaned options.Directory", options.Directory)
22+
1923
// If the file already exists, exit early
2024
if _, err := os.Stat(filepath.Join(options.Directory, "MicrosoftEdgeWebview2Setup.exe")); err == nil {
2125
return nil

v3/internal/templates/base/frontend/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"type": "module",
66
"scripts": {
77
"dev": "vite",
8-
"build": "vite build --minify false --mode development",
9-
"build:prod": "vite build --mode production",
8+
"build:dev": "vite build --minify false --mode development",
9+
"build": "vite build --mode production",
1010
"preview": "vite preview"
1111
},
1212
"devDependencies": {

v3/internal/templates/lit-ts/frontend/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
"type": "module",
66
"scripts": {
77
"dev": "vite",
8-
"build": "tsc && vite build"
8+
"build:dev": "tsc && vite build --minify false --mode development",
9+
"build": "tsc && vite build --mode production",
10+
"preview": "vite preview"
911
},
1012
"dependencies": {
1113
"lit": "^3.1.0"

v3/internal/templates/lit/frontend/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"type": "module",
66
"scripts": {
77
"dev": "vite",
8-
"build": "vite build",
8+
"build:dev": "vite build --minify false --mode development",
9+
"build": "vite build --mode production",
910
"preview": "vite preview"
1011
},
1112
"dependencies": {

v3/internal/templates/preact-ts/frontend/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"type": "module",
66
"scripts": {
77
"dev": "vite",
8-
"build": "tsc && vite build",
8+
"build:dev": "tsc && vite build --minify false --mode development",
9+
"build": "tsc && vite build --mode production",
910
"preview": "vite preview"
1011
},
1112
"dependencies": {

v3/internal/templates/preact/frontend/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"type": "module",
66
"scripts": {
77
"dev": "vite",
8-
"build": "vite build",
8+
"build:dev": "vite build --minify false --mode development",
9+
"build": "vite build --mode production",
910
"preview": "vite preview"
1011
},
1112
"dependencies": {

v3/internal/templates/qwik-ts/frontend/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"type": "module",
66
"scripts": {
77
"dev": "vite",
8-
"build": "tsc && vite build",
8+
"build:dev": "tsc && vite build --minify false --mode development",
9+
"build": "tsc && vite build --mode production",
910
"preview": "vite preview"
1011
},
1112
"devDependencies": {

0 commit comments

Comments
 (0)