oscartbeaumont / tauri-specta

Completely typesafe Tauri commands
MIT License
289 stars 26 forks source link

tauri with nextjs requires importing invoke from tauri-apps/api/tauri #63

Closed StoicDeveloper closed 2 months ago

StoicDeveloper commented 7 months ago

Currently tauri-specta generates a binding.ts file with the following line:

import { invoke as TAURI_INVOKE } from "@tauri-apps/api";

When building the app cargo tauri dev using the NextJS framework, prerendering the app pages gives the following error:

ReferenceError: window is not defined

If the import is manually changed to

import { invoke as TAURI_INVOKE } from "@tauri-apps/api/tauri";

Then building the app works fine.

StoicDeveloper commented 7 months ago

Related: https://github.com/tauri-apps/tauri/issues/7488

SamHep0803 commented 3 months ago

Any update on this?

Brendonovich commented 2 months ago

This is fixed on main, it can be releases in another rc release

oscartbeaumont commented 2 months ago

This should be solved with Tauri v2 as the import is now @tauri-apps/api/core.

Will be releasing Tauri v2 support in the coming days once a few minor bugs are sorted out.