mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-04-03 10:11:15 +02:00
fix(tauri.js) properly reflect tauri.conf changes on tauri dev (#672)
This commit is contained in:
committed by
GitHub
parent
5efde04509
commit
4975497dad
@@ -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(
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user