refactor: The injection process does not affect the logic of the development environment.

This commit is contained in:
jeasonnow
2023-06-10 10:35:27 +08:00
parent 3202fcdb73
commit 3b2e305a0c
5 changed files with 4 additions and 8 deletions

View File

@@ -300,14 +300,7 @@ export async function mergeTauriConfig(
// 设置安全调用 window.__TAURI__ 的安全域名为设置的应用域名
setSecurityConfigWithUrl(tauriConf, url);
// 内部注入文件
const internalInjectScripts = [
path.join(npmDirectory, 'bin/inject/component.js'),
path.join(npmDirectory, 'bin/inject/event.js'),
path.join(npmDirectory, 'bin/inject/style.js'),
];
let injectFiles = [...internalInjectScripts];
let injectFiles: string[] = [];
// 注入外部 js css
if (inject?.length > 0) {
if (!inject.every(item => item.endsWith('.css') || item.endsWith('.js'))) {

View File

@@ -27,6 +27,9 @@ pub fn get_window(app: &mut App, config: PakeConfig, _data_dir: PathBuf) -> Wind
.fullscreen(window_config.fullscreen)
.inner_size(window_config.width, window_config.height)
.disable_file_drop_handler()
.initialization_script(include_str!("../inject/component.js"))
.initialization_script(include_str!("../inject/event.js"))
.initialization_script(include_str!("../inject/style.js"))
.initialization_script(include_str!("../inject/_INJECT_.js")); //Very annoying, otherwise dragging files to the window will not work.
#[cfg(target_os = "macos")]