Closed elibroftw closed 2 years ago
I deleted the release target folder and this is what I got after building. tauri build is completely broken. I have no idea if this is a ReactJS build fault, but this is a serious problem!
Can confirm this is a Tauri issue because npx serve -s build
works fine.
Alright, again please paste the full output of tauri info
that will include the OS and Tauri version by default.
That you are experiencing a broken build after your PC crashed mid-compilation doesn't surprise me. Run cargo clean
or remove the target
folder to remove all build artifacts.
And yes, Rust wants you to keep your build artifacts between runs. This is called incremental compilation and it's the key to compile times that humans can actually endure.
Regarding your second post, all Tauri related code seems to have compiled just fine, otherwise you wouldn't get a window + webview at all.
This seems like missing styles to me right? Have you checked the Sources
or Network
tab in the devtools for weird behavior?
Addtionally, please file individual issues for each problem you find instead of listing them in a single one.
I know it's incremental compiling, I'm saying that if there is an issue with an older file, it should be deleted. You guys probably aren't responsible for it anyways.
As for the devtools, how can I check devtools if this is a release build?
You guys probably aren't responsible for it anyways.
Yep yep, that's it.
As for the devtools, how can I check devtools if this is a release build?
Either by creating a debug build (tauri build --debug
-> output in /target/debug/) or by enabling the devtools
flag on the tauri dependency in Cargo.toml
--debug
doesn't allow me to open devtools with F12 or Ctrl + Shift + I or with right clicking. How do I enable the devtools flag on the dependency in cargo.toml?
--debug doesn't allow me to open devtools with F12 or Ctrl + Shift + I or with right clicking.
This is not really possible. Using tauri dev
is pretty much the same as a debug build (in that regard), so if one works the other has to work too.
How do I enable the devtools flag on the dependency in cargo.toml?
Add it to the existing features
array, something like this
tauri = {version = "1.0.0-rc.4", features = ["dialog-open", "devtools"] }
No errors in sources or network, but under console, I see this 4 times
Refused to apply inline style because it violates the following Content Security Policy directive: "style-src 'self' 'nonce-13143795633524851910'". Either the 'unsafe-inline' keyword, a hash ('sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU='), or a nonce ('nonce-...') is required to enable inline execution.
Enabling CSP disallows inline styles (by default): https://tauri.app/docs/development/security/#secure-content-loading. In theory you'd need to add 'unsafe-inline' as the error says, but you really shouldn't do this (there's a reason it's called unsafe), also because we add nonces to the CSP config, unsafe-inline shouldn't have an effect, see parts of the discussion here: https://github.com/tauri-apps/tauri/issues/3583.
So what is the solution? I have 0 clue how to replace my inline styles because it is React, and 0 clue how to stop tauri from throwing a tantrum.
How can Tauri get hacked if it's supposed to be self contained? It's only possible if the users device is already compromised?
So what is the solution? I have 0 clue how to replace my inline styles because it is React
React does support CSS files too. Actually their docs recommend that too for performance reasons (kinda sad that they don't mention security stuff anywhere 🤔)
How can Tauri get hacked if it's supposed to be self contained? It's only possible if the users device is already compromised?
I suggest reading the security
doc page, it hopefully answers your questions. For more i'll leave this question for the security experts (really not my field of expertise (yet?)).
Well I removed security entirely and that fixed it
That's indeed an interesting "fix" 👍
It does say in the docs "With the CSP protection enabled, using inline style attributes it not allowed." So according to CSP, its either all security or no security.
The typo is in the docs btw https://tauri.app/docs/development/security/#secure-content-loading
It does say in the docs [...]
Yes i know that. I'm just surprised every time a dev chooses the way of least friction no matter the security "cost".
The typo is in the docs btw
Thanks, we'll fix this.
Well, you aren't letting me know of a way to allow inline styles with CSP enables, and I chose React to reduce development time in the first place, but I'm starting to think it's causing more problems that necessary. It's not just Tauri. It's the entire dev tool system that causes havoc.
Like is unsafe-inline
getting ignored or something?
Well it started working even with CSP. Might've changed a setting somewhere to make it work.
Describe the bug
I ran
yarn rls
which callsyarn tauri build
and my computer crashed. I highly doubt it was a coincidence since my computer usually crashes if the power goes out, and my power did not go out. This is the second time something fishy happened. Earlier today, my taskbar disappeared after I was greeted with a black screen for a good 10 seconds. Another issue is that I have two monitors and Tauri (at least in dev mode) will crash if I don't move the window fast enough between the monitors.Anyways, I ran build again and got:
If Tauri is going to tell me to delete the build files, it might as well delete them itself. No? I don't think people expect to keep their old build files when building do they?
Reproduction
yarn tauri build
.conf.json
is configured to runyarn build
firstExpected behavior
It should work without crashing my computer and shouldn't need user intervention to delete build files. Builds should crash due to source code errors, not because a file wasn't expected to be a certain way.
Platform and versions
Stack trace
Additional context
Tauri Info
``` Operating System - Windows, version 10.0.19044 X64 Webview2 - 99.0.1150.39 Visual Studio Build Tools: - Visual Studio Community 2022 Node.js environment Node.js - 17.3.1 @tauri-apps/cli - 1.0.0-rc.6 @tauri-apps/api - 1.0.0-rc.2 Global packages npm - 8.3.0 pnpm - Not installed yarn - 1.22.11 Rust environment rustup - 1.24.3 rustc - 1.57.0 cargo - 1.57.0 toolchain - stable-x86_64-pc-windows-msvc App directory structure /.git /assets /build /dist /node_modules /public /pyi-specs /src /src-tauri /__pycache__ App tauri - 1.0.0-rc.4 tauri-build - 1.0.0-rc.4 tao - 0.6.4 wry - 0.13.3 build-type - bundle CSP - default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self' distDir - ../build devPath - http://127.0.0.1:3000/ framework - React Done in 7.74s. ```