Fix/includedir (#751)

* fix(tauri) assets embedding regression

* fix(tauri) fix & optimize embedded assets
This commit is contained in:
Lucas Fernandes Nogueira 2020-07-05 01:45:07 -03:00 committed by GitHub
parent e8ecd3ce3f
commit c3b5c1fdf8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 4 deletions

6
.changes/assets-fix.md Normal file
View File

@ -0,0 +1,6 @@
---
"tauri.js": patch
"tauri": patch
---
Fixes the assets embedding into the binary.

View File

@ -141,7 +141,7 @@ class Runner {
inlinedAssets = (await this.__parseHtml(cfg, devPath)).inlinedAssets
}
process.env.TAURI_INLINED_ASSSTS = inlinedAssets.join('|')
process.env.TAURI_INLINED_ASSETS = inlinedAssets.join('|')
this.devPath = devPath
@ -225,7 +225,7 @@ class Runner {
this.__rewriteManifest(cargoManifest)
const inlinedAssets = (await this.__parseHtml(cfg, cfg.build.distDir)).inlinedAssets
process.env.TAURI_INLINED_ASSSTS = inlinedAssets.join('|')
process.env.TAURI_INLINED_ASSETS = inlinedAssets.join('|')
const features = [
cfg.tauri.embeddedServer.active ? 'embedded-server' : 'no-server'

View File

@ -36,7 +36,7 @@ once_cell = "1.4.0"
tauri-api = { version = "0.7", path = "../tauri-api" }
[build-dependencies]
tauri_includedir_codegen = "0.6.1"
tauri_includedir_codegen = "0.6.2"
cfg_aliases = "0.1.0"
[dev-dependencies]

View File

@ -24,15 +24,24 @@ pub fn main() -> Result<(), Box<dyn Error>> {
println!("cargo:rerun-if-changed={}", dist_path_string);
let inlined_assets = match std::env::var_os("TAURI_INLINED_ASSETS") {
let mut inlined_assets = match std::env::var_os("TAURI_INLINED_ASSETS") {
Some(assets) => assets
.into_string()
.unwrap()
.split('|')
.map(|s| s.to_string())
.filter(|s| s != "")
.collect(),
None => Vec::new(),
};
// the index.html is parsed so we always ignore it
inlined_assets.push("index.html".to_string());
if cfg!(feature = "no-server") {
// on no-server we include_str() the index.tauri.html on the runner
inlined_assets.push("index.tauri.html".to_string());
}
// include assets
tauri_includedir_codegen::start("ASSETS")
.dir(