wailsapp / wails

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

[linux] local css file loaded via custom asset handler within iframe not loading correctly in dev mode #2874

Closed christian-schulze closed 12 months ago

christian-schulze commented 12 months ago

Description

The minimum reproduction linked below renders an <iframe> referencing a local html file, which is loaded via a custom asset handler. This html file loads a css file via a <link> tag using a relative path ../css/styled.css.

The css file loads correctly in production mode (wails build then run app), and in dev mode if you view the app content in a web browser (Google Chrome). It does not load correctly in dev mode within the app.

See the screenshot provided below, the response content of the request is javascript and appears to be vite/hot reload related.

To Reproduce

Minimum reproduction available here: https://github.com/christian-schulze/wail-test

Expected behaviour

local css file loaded within <iframe> via <link> tag should load correctly in dev mode within the app.

Screenshots

Screenshot_20230830_111433

Attempted Fixes

No response

System Details

Wails CLI v2.5.1

 SUCCESS  Done.                                                                                                                                            

# System

OS           | EndeavourOS
Version      | Unknown    
ID           | endeavouros
Go Version   | go1.21.0   
Platform     | linux      
Architecture | amd64      

# Wails

Version         | v2.5.1
Package Manager | pacman

# Dependencies

Dependency | Package Name | Status    | Version    
*docker    | docker       | Installed | 1:24.0.5-1 
gcc        | gcc          | Installed | 13.2.1-3   
libgtk-3   | gtk3         | Installed | 1:3.24.38-1
libwebkit  | webkit2gtk   | Installed | 2.40.5-2   
npm        | npm          | Installed | 9.8.1      
pkg-config | pkgconf      | Installed | 1.8.1-1    
* - Optional Dependency

# Diagnosis

Your system is ready for Wails development!

Additional context

No response

stffabi commented 12 months ago

Thanks for using Wails and reporting this issue.

This is a duplicate of #2705 and is currently a known issue related due to old Webkit versions not providing the request headers and Vite. You could either use an import instead of a link for the CSS file or you could bump your minimum Webkit2 requirement to 2.36 when building your App. You can find more details here.

stffabi commented 12 months ago

Duplicate of #2705

christian-schulze commented 12 months ago

Thanks for the info @stffabi and apologies for duplicate issue. I did do a search but clearly not a good one.

Have confirmed wails dev -tags webkit2_36 works perfectly :+1:

stffabi commented 12 months ago

No worries, glad I could help.