Closed mikoto2000 closed 5 days ago
I opened a PR for this:
import { appWindow } from '@tauri-apps/api/window'
becomes import { getCurrent as appWindow } from 'webviewWindow'
, you still gonna need to do manual changes because appWindow
will be a function and you'll need to add ()
after each call to it.@amrbashir Thank you for fix and comment!
And sorry, there were some omissions in reporting some steps regarding the dialogues. There may have been a problem with these steps.
Added the following to Cargo.toml
according to Upgrade from Tauri 1.0 | Tauri
[lib]
name = "app_lib"
crate-type = ["staticlib", "cdylib", "rlib"]
I got this error:
Compiled successfully!
You can now view scab-player in the browser.
Local: http://localhost:3000
On Your Network: http://172.17.0.3:3000
Note that the development build is not optimized.
To create a production build, use npm run build.
webpack compiled successfully
Files successfully emitted, waiting for typecheck results...
Issues checking in progress...
No issues found.
Info Watching /home/node/scab-player2/src-tauri for changes...
warning: output filename collision.
The lib target `app_lib` in package `scab-player v0.1.0 (/home/node/scab-player2/src-tauri)` has the same output filename as the lib target `app_lib` in package `scab-player v0.1.0 (/home/node/scab-player2/src-tauri)`.
Colliding filename is: /home/node/scab-player2/src-tauri/target/debug/deps/libapp_lib.rlib
The targets should have unique names.
Consider changing their names to be unique or compiling them separately.
This may become a hard error in the future; see <https://github.com/rust-lang/cargo/issues/6313>.
thread 'main' panicked at src/cargo/core/compiler/fingerprint/mod.rs:1103:13:
assertion failed: mtimes.insert(output.clone(), mtime).is_none()
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
The template created by npm create tauri-app@latest -- --beta
did not include rlib
, so I removed rlib
.
@tauri-apps/api
to 2.x.x-beta.xx
.I change to 2.0.0-beta.14
manually.
(Is there any intention for the migration tool not to change this?)
I create minimum code(repository: mikoto2000/TauriMigrationExample).
App.tsx:
import { dialog } from '@tauri-apps/api'
import './App.css';
function App() {
async function selectChannelBaseDirectory() {
const _ = await dialog.open({
title: "Select channel base directory",
directory: true
});
}
return (
<div className="App">
<button onClick={selectChannelBaseDirectory} >チャンネル選択</button>
</div>
);
}
export default App;
From Migrate to Dialog Plugin - Upgrade from Tauri 1.0 | Tauri,
dialog
is need migrate to plugin-dialog
.
So, expected result is this(But I didn't change the migration tool):
import { open } from '@tauri-apps/plugin-dialog';
import './App.css';
function App() {
async function selectChannelBaseDirectory() {
await open({
title: "Select channel base directory",
directory: true
});
}
return (
<div className="App">
<button onClick={selectChannelBaseDirectory} >チャンネル選択</button>
</div>
);
}
export default App;
in the dialog example you provided,
import { dialog } from '@tauri-apps/api';
will change to
import dialog from '@tauri-apps/plugin-dialog';
so the rest of the code should work
@amrbashir Got it, understood. Thank you for the corrections!
Describe the bug
When using the migration tool, the following parts were incorrectly corrected, causing an error.
import { convertFileSrc } from '@tauri-apps/api/tauri'
->import { convertFileSrc } from 'core'
import { appWindow } from '@tauri-apps/api/window'
->import { appWindow } from 'webviewWindow'
2.
)appWindow
-> not change(appWindow
not defined)import { dialog } from '@tauri-apps/api'
-> not changeThese have been corrected as follows.
import { convertFileSrc } from '@tauri-apps/api/core'
import { appWindow } from '@tauri-apps/api/webviewWindow'
appWindow
togetCurrent
and otherappWindow
same changes.import { open } from '@tauri-apps/plugin-dialog'
For 1. and 2., we will probably need to update this process.
https://github.com/tauri-apps/tauri/blob/11aa7743e7a277ed9ec3e92040dc484afe77d261/tooling/cli/src/migrate/frontend.rs#L57-L59
I don't think the migration tool can handle
3.
and4.
, but I wanted to report it just in case.Reproduction
Expected behavior
This error should not occur.
Full
tauri info
outputStack trace
Additional context
No response