-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bug] Styles don't get bundled #3427
Comments
I have the same exact issue with angular. |
Can one of you share your tauri.conf file? |
In my case it's the default config created by
|
This is mine
|
Are there any warnings in the log during |
And does this happen if you run |
The styles should exist on the distDir folder. Maybe angular is not configured to do so, and it stays on the public directory? i'm not at home right now but i can check this tomorrow. |
Did you guys check the console for errors? it might also be a CSP error, so you can try setting the csp to null on tauri.conf.json |
Setting |
I have the same behavior as kt215, there are no warnings and it only works with |
The content security policy is a nice security feature but it needs configuration from your side, like allowing accessing remote fonts and stylesheets, so that might be the issue here. For now I'll change the default template to disable CSP so new users don't need to face this, but our documentation still encourage you to implement CSP for your app as that secures you from untrusted content loading. |
@lucasfernog I am using the @suid/material library and I'm having the same issue with my styles. My CSP is set to |
@dolsem I can take a look if you can share a repo to reproduce it. |
@lucasfernog Please check https://github.com/dolsem/tauri-suid-test |
Suid has dynamic styles, I'll see if there's a way around it. |
@dolsem not much we can do here since @suid/material dynamically adds style tags so you'd need to disable the style-src modification from Tauri https://tauri.studio/v1/api/config#securityconfig.dangerousdisableassetcspmodification |
Might be resurrecting a zombie here. I recently faced the same problem. Solved it by setting the production build setting on my angular project to:
More on this here: https://0xdbe.github.io/AngularSecurity-DisableInlineCriticalCSS/ Followed Angular's recommendation on a minimal CSP setting, and adjusted it to my needs to something like:
Would be nice to have a Tauri setting in order to be able to dynamically configure an allowed nonce, acording to the TAURI_SCRIPT_NONCE and TAURI_STYLE_NONCE . Didn't find if it's possible to override Tauri's generated values, or place a placeholder in the configuration in order to allow the generated on compilation nonce values. |
To add my own because it took a bit of debugging, I could fix // Does NOT work
"csp": "default-src 'self'; img-src 'self' asset: https://asset.localhost" to this: // Works
"csp": "default-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' asset: https://asset.localhost" Note that I had already set the |
Describe the bug
when i run
tauri dev
the styles work normally, but when i dotauri build
the styles are not added to the bundleWith
tauri dev
With
tauri build
Reproduction
create-tauri-app
, select Typescript@fluentui/react
withyarn add @fluentui/react
PrimaryButton
andDefaultButton
cargo tauri dev
and the styles loadcargo tauri build
and the components appear without stylesExpected behavior
No response
Platform and versions
Operating System - Windows, version 10.0.22000 X64 Webview2 - 98.0.1108.43 Visual Studio Build Tools: - Visual Studio Build Tools 2019 Node.js environment Node.js - 16.14.0 @tauri-apps/cli - 1.0.0-rc.0 @tauri-apps/api - 1.0.0-rc.0 Global packages npm - 8.3.1 pnpm - Not installed yarn - 1.22.17 Rust environment rustc - 1.58.1 cargo - 1.58.0 Rust environment rustup - 1.24.3 rustc - 1.58.1 cargo - 1.58.0 toolchain - stable-x86_64-pc-windows-msvc App directory structure /.git /build /node_modules /public /src /src-tauri App tauri.rs - 1.0.0-rc.1 build-type - bundle CSP - default-src 'self' distDir - ../build devPath - http://localhost:3000/ framework - React Note: It says Windows 10 but is Windows 11
Stack trace
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: