wailsapp / wails

Create beautiful applications using Go
https://wails.io
MIT License
25.55k stars 1.24k forks source link

Frontend routing causes the product mode to be unable to access assets. #3585

Closed mostend closed 5 months ago

mostend commented 5 months ago

Description

Frontend routing causes the product mode to be unable to access assets.

To Reproduce

  1. create route
    
    import { createRouter, createWebHistory } from 'vue-router'

import HomeView from './components/HomeView.vue' import ResultView from './components/ResultView.vue'

const routes = [ { path: '/', component: HomeView }, { path: '/result', component: ResultView }, ]

const router = createRouter({ history: createWebHistory(), routes, })

export default router

2. Create two windows, one / and one /result
mainWindow := app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
    Title:               "Commander",
    Mac: application.MacWindow{
        InvisibleTitleBarHeight: 50,
        Backdrop:                application.MacBackdropTranslucent,
        TitleBar:                application.MacTitleBarHiddenInset,
    },
    Windows: application.WindowsWindow{
        DisableIcon: true,
    },
    URL: "/",
})
    resultWindow := app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
    Title:               "Result",
    Width:               1480,
    Height:              800,
    Centered:            true,
    DisableResize:       true,
    ZoomControlEnabled:  true,
    EnableDragAndDrop:   true,
    CloseButtonState:    application.ButtonEnabled,
    MaximiseButtonState: application.ButtonDisabled,
    Mac: application.MacWindow{
        InvisibleTitleBarHeight: 50,
        Backdrop:                application.MacBackdropTranslucent,
        TitleBar:                application.MacTitleBarHiddenInset,
    },
    Windows: application.WindowsWindow{
        DisableIcon: true,
    },
    URL: "/result",
})
resultWindow.Show()

3. Open using the dev mode, and then open the binary file after building.
   dev mode 
![image](https://github.com/wailsapp/wails/assets/11625729/71be8746-5070-46bb-9d72-0b7d5eb7d1b5)
   after building 
![image](https://github.com/wailsapp/wails/assets/11625729/ee9278bb-68d6-426a-8475-65430ac960b0)

Thanks for checking. 

### Expected behaviour

dev mode and production mode must be same 

### Screenshots

_No response_

### Attempted Fixes

_No response_

### System Details

```shell
PS C:\Users\Mostend\Desktop\Commander> wails3 doctor

          Wails Doctor

# System
┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
| Name              | Windows 10 Enterprise                                                                             |
| Version           | 2009 (Build: 22631)                                                                               |
| ID                | 23H2                                                                                              |
| Branding          | Windows 11 企业版                                                                                 |
| Platform          | windows                                                                                           |
| Architecture      | amd64                                                                                             |
| Go WebView2Loader | true                                                                                              |
| WebView2 Version  | 126.0.2592.81                                                                                     |
| CPU               | 13th Gen Intel(R) Core(TM) i9-13900HX                                                             |
| GPU 1             | OrayIddDriver Device (Shanghai Best Oray Information Technology Co., Ltd.) - Driver: 17.1.58.818  |
| GPU 2             | NVIDIA GeForce RTX 4060 Laptop GPU (NVIDIA) - Driver: 31.0.15.2866                                |
| Memory            | 32GB                                                                                              |
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

# Build Environment
┌─────────────────────────────────────────────────────────┐
| Wails CLI    | v3.0.0-alpha.4                           |
| Go Version   | go1.22.4                                 |
| Revision     | cfe2424f4d9d13fc1c08148ca84604a092798f28 |
| Modified     | false                                    |
| -buildmode   | exe                                      |
| -compiler    | gc                                       |
| CGO_ENABLED  | 0                                        |
| GOAMD64      | v1                                       |
| GOARCH       | amd64                                    |
| GOOS         | windows                                  |
| vcs          | git                                      |
| vcs.modified | false                                    |
| vcs.revision | cfe2424f4d9d13fc1c08148ca84604a092798f28 |
| vcs.time     | 2024-06-30T21:11:45Z                     |
└─────────────────────────────────────────────────────────┘

# Dependencies
┌───────────────────────────┐
| npm  | 10.8.1             |
| NSIS | Not Installed      |
└─ * - Optional Dependency ─┘

# Diagnosis
 SUCCESS  Your system is ready for Wails development!

Need documentation? Run: wails3 docs

 ♥   If Wails is useful to you or your company, please consider sponsoring the project: wails3 sponsor

Additional context

No response

leaanthony commented 5 months ago

Hi there! Thanks for this feedback. Whilst v3 is in alpha, we have a strict feedback procedure outlined here: https://v3alpha.wails.io/getting-started/feedback This is to reduce noise whilst the branch is unstable and keep all the information in one place. We'd love to have you as part of the v3 feedback loop so please consider opening a new post there. Just a copy and paste would be fine. Closing this for now. Thanks again 🙏