You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
背景
在开发模式(
tauri dev
)下,位于src-tauri
目录中的任意文件变更都会引发应用的重新构建,每次构建 Tauri 都会重新启动应用,影响开发体验。解决方案
此类问题如果只看官方文档,并不能找到相关描述,所以查看 issues 及相关工具链版本升级的
changelog
就显得尤为重要(个人经验:新技术可参考资料稀少,所以对其探索更容易培养解决问题的能力)。升级 CLI
升级
@tauri-apps/cli
到v1.1.0+
版本使用
@tauri-apps/cli v1.1.0
版本新增了两种忽略方式(.taurignore
和--no-watch
):1. 使用忽略文件
.taurignore
:在
src-tauri
下创建.taurignore
忽略文件,底层依赖 ignore crate,忽略规则设置请查看 ignore 文档,与.gitignore
规则类似。(注意:经验证,@tauri-apps/cli v1.1.1
版本在设置除*
之外的任意路径规则并未生效,官方目前并未给出解决方案)2. 使用命令行参数
--no-watch
:结论: 使用任意一种方式在开发模式(
tauri dev
),src-tauri
目录中任意文件变更都将不会引起应用构建及重启,请谨慎使用。参考资料
Beta Was this translation helpful? Give feedback.
All reactions