-
|
Hello everyone. I’m creating an app with tauri. I build it with [cargo cross(https://github.com/cross-rs/cross) with rust GNU toolchain for windows. I build it on linux with windows as a target platform. In official docs there’s a recommendation to use MSVC, but the gmp-mpfr-sys dep I use in my rust project does not support MSVC, so I’m forced to use GNU. cross build --target x86_64-pc-windows-gnu --package signer --release
# then
cargo tauri bundle --target x86_64-pc-windows-gnuIt produces these logs The installer is created, so I sent it to the users with windows machines. But, when users on windows run the app, they see an error from the screenshot that I attached: Can you please help me, why, despite successful build, the app doesn’t work on windows Here’s the tauri.conf {
"$schema": "https://schema.tauri.app/config/2",
"productName": "signer",
"version": "0.1.0",
"identifier": "com.signer.corp",
"build": {
"beforeDevCommand": "npm run dev",
"devUrl": "http://localhost:1420",
"beforeBuildCommand": "npm run build",
"frontendDist": "../dist"
},
"app": {
"windows": [
{
"title": "signer",
"width": 1280,
"height": 720,
"dragDropEnabled": false
}
],
"security": {
"csp": null
},
"withGlobalTauri": true
},
"bundle": {
"active": true,
"targets": "all",
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/[email protected]",
"icons/icon.icns",
"icons/icon.ico"
]
}
}Here’s the vite.conf import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import path from 'path';
import fs from 'fs';
// @ts-expect-error process is a nodejs global
const host = process.env.TAURI_DEV_HOST;
// https://vitejs.dev/config/
export default defineConfig(async () => ({
plugins: [
react(),
{
name: 'raw-svg-loader',
transform(_, id) {
if (id.endsWith('.svg')) {
// For regular SVG imports, return the raw SVG content
if (!id.includes('?')) {
// Read the file and return raw SVG content
const filePath = id.split('?')[0]; // Remove query params
const svgContent = fs.readFileSync(filePath, 'utf8');
return `export default ${JSON.stringify(svgContent)}`;
}
}
},
},
],
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
// Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`
//
// 1. prevent vite from obscuring rust errors
clearScreen: false,
// 2. tauri expects a fixed port, fail if that port is not available
server: {
port: 1420,
strictPort: true,
host: host || false,
hmr: host
? {
protocol: "ws",
host,
port: 1421,
}
: undefined,
watch: {
// 3. tell vite to ignore watching `src-tauri`
ignored: ["**/src-tauri/**"],
},
},
}));Maybe some url is set incorrectly? Why it can't reach localhost? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
2 things i noticed:
|
Beta Was this translation helpful? Give feedback.

Thanks! You were spot-on on both points.
1)
beforeBuildCommandMy broken flow was:
That second step didn’t recompile the Rust binary, so
beforeBuildCommandwasn’t run for the exe that got bundled ⇒../distwasn’t embedded.What fixed it was doing it in one step so Tauri runs the front build and rebuilds the Rust exe:
After that the exe grew ~100 KB so the UI is actually embedded.
2)
-dflagYou’re right — that
-dline was from a debug trial. The failing installer came from the two-step flow above, but point taken:-dwould u…