Skip to content

Package the front-end project to generate exe file through Tauri(通过Tauri将前端项目打包成exe可执行文件)

Notifications You must be signed in to change notification settings

ZY945/tauri-build-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

笔记路径

https://www.yuque.com/zhangyang.com/tuiv0m/aev9n21009v4gqok#JnlPW

打包前端项目成为exe可执行文件

rustc 1.78.0
cargo 1.78.0
node v16.17.0

启动过程

yarn tauri dev

构建

yarn tauri build

如何把已有的vue项目构建成应用程序

官方文档https://tauri.app/zh-cn/v1/guides/getting-started/setup/integrate 在package.json添加,然后把src-tauri文件夹拖入项目内

"@tauri-apps/api": "^1"

本地路径

tauri打包后axios请求失败(有对应插件可以解决)

复现场景:开发环境直接启动没报错,构建成exe文件后启动报错 感谢提供的案例,个人首页地址为https://github.com/M-1202 本地路径 解决办法:https://github.com/persiliao/axios-tauri-api-adapter

有个插件可以使用https://github.com/persiliao/axios-tauri-api-adapter 一、添加依赖

npm install axios-tauri-api-adapter

二、 在你使用axios创建实例的地方添加adapter: axiosTauriApiAdapter

import axios from 'axios';
import axiosTauriApiAdapter from 'axios-tauri-api-adapter';
const client = axios.create({ adapter: axiosTauriApiAdapter });

三、在tauri.config.json根据你的后端网站进行添加

{
  "tauri": {
    "allowlist": {
      "http": {
        "all": true, // Use this flag to enable all HTTP API features.
        "request": true, // Allows making HTTP requests.
        "scope": ["https://example.com/*"] // access scope for the HTTP APIs.
      }
    }
  }
}

About

Package the front-end project to generate exe file through Tauri(通过Tauri将前端项目打包成exe可执行文件)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published