tauri-apps / plugins-workspace

All of the official Tauri plugins in one place!
https://tauri.app
Apache License 2.0
966 stars 272 forks source link

[log] Impact on request consumption time (Android emulator) #853

Open hanaTsuk1 opened 10 months ago

hanaTsuk1 commented 10 months ago

In the Windows environment, the first screen takes a few seconds, and after refreshing, the request only takes a few hundred milliseconds In the Android environment, there is not much difference in time between the first screen and refresh, which takes one minute At the same time, the console warns "DevTools failed to load source map"

tauri = { version = "2.0.0-alpha.20" }

tauri-build = { version = "2.0.0-alpha.13"}

// vite.config.ts
  server: {
    port: 1420,
    strictPort: true,
    host: mobile ? '0.0.0.0' : false,
    hmr: mobile
      ? {
          protocol: 'ws',
          host: await internalIpV4(),
          port: 1421,
        }
      : undefined,
    watch: {
      // 3. tell vite to ignore watching `src-tauri`
      ignored: ['**/src-tauri/**'],
    },
  },

Originally posted by @hanaTsuk1 in https://github.com/tauri-apps/tauri/discussions/8471

hanaTsuk1 commented 10 months ago

When I comment out the code below, the request takes time reduced to normal

tauri-plugin-log = "2.0.0-alpha.6"

.plugin(
    tauri_plugin_log::Builder::new()
        .clear_targets()
        .targets([
            Target::new(TargetKind::LogDir {
                file_name: Some("webview".into()),
            })
            .filter(|metadata| metadata.target() == WEBVIEW_TARGET),
            Target::new(TargetKind::LogDir {
                file_name: Some("rust".into()),
            })
            .filter(|metadata| metadata.target() != WEBVIEW_TARGET),
            Target::new(TargetKind::Stdout),
            Target::new(TargetKind::Webview),
        ])
        .timezone_strategy(TimezoneStrategy::UseLocal)
        .build(),
)