tauri: [bug] Styles don't get bundled
Describe the bug
when i run tauri dev the styles work normally, but when i do tauri build the styles are not added to the bundle
With tauri dev

With tauri build

Reproduction
- Create new project with
create-tauri-app, select Typescript - Add
@fluentui/reactwithyarn add @fluentui/react - Add a button from fluentui, i added
PrimaryButtonandDefaultButton - run
cargo tauri devand the styles load - run
cargo tauri buildand the components appear without styles
Expected 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
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 19 (9 by maintainers)
Commits related to this issue
- refactor(cli.rs): change template config CSP to null, closes #3427 — committed to tauri-apps/tauri by lucasfernog 2 years ago
- Use csp config from https://github.com/tauri-apps/tauri/issues/3427 to fix assets issue — committed to Orbitale/Compotes by Pierstoval a year ago
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.