fix(tauri.js) properly reflect tauri.conf changes on tauri dev (#672)

This commit is contained in:
Lucas Fernandes Nogueira
2020-06-13 20:11:13 -03:00
committed by GitHub
parent 5efde04509
commit 4975497dad
2 changed files with 14 additions and 3 deletions

View File

@@ -1,4 +1,4 @@
import { existsSync } from 'fs-extra'
import { existsSync, readFileSync } from 'fs-extra'
import { TauriConfig } from 'types'
import merge from 'webpack-merge'
import logger from '../helpers/logger'
@@ -21,7 +21,7 @@ const getTauriConfig = (cfg: Partial<TauriConfig>): TauriConfig => {
)
process.exit(1)
}
const tauriConf = nonWebpackRequire(tauriConfPath) as TauriConfig
const tauriConf = JSON.parse(readFileSync(tauriConfPath).toString()) as TauriConfig
const pkg = nonWebpackRequire(pkgPath) as { productName: string }
const config = merge(

View File

@@ -1,5 +1,6 @@
#[cfg(any(feature = "embedded-server", feature = "no-server"))]
pub fn main() {
shared();
match std::env::var_os("TAURI_DIST_DIR") {
Some(dist_path) => {
let dist_path_string = dist_path.into_string().unwrap();
@@ -29,4 +30,14 @@ pub fn main() {
}
#[cfg(not(any(feature = "embedded-server", feature = "no-server")))]
pub fn main() {}
pub fn main() {
shared();
}
fn shared() {
if let Some(tauri_dir) = std::env::var_os("TAURI_DIR") {
let mut tauri_path = std::path::PathBuf::from(tauri_dir);
tauri_path.push("tauri.conf.json");
println!("cargo:rerun-if-changed={:?}", tauri_path);
}
}