Tauri Mobile Msg: Uncaught plugin fs not found
DIMFLIX-OFFICIAL opened this issue Β· comments
DIMFLIX commented
π Page(s) affected (or suggested, for new content)
https://beta.tauri.app/2/reference/js/fs/
π Description or bullet point outline (if proposing new content)
I'm trying to work with the file system (I want to create a data.json to save the necessary data there directly from JS)
An error occurs when building the application
11-11 12:06:33.714 10067 10067 E Tauri/Console: File: http://tauri.localhost/ - Line 0 - Msg: Uncaught plugin fs not found
Please help me!
tauri.conf.json
{
"build": {
"beforeDevCommand": "pnpm dev",
"beforeBuildCommand": "pnpm build",
"devPath": "http://localhost:1420",
"distDir": "../dist",
"withGlobalTauri": true
},
"package": {
"productName": "barrier-app",
"version": "0.0.0"
},
"tauri": {
"bundle": {
"active": true,
"targets": "all",
"identifier": "com.tauri.dev",
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/128x128@2x.png",
"icons/icon.icns",
"icons/icon.ico"
],
"resources": [
"data/data.json"
]
},
"security": {
"csp": null
},
"windows": [
{
"fullscreen": true,
"resizable": true,
"title": "barrier-app",
"width": 800,
"height": 600,
"decorations": false
}
]
},
"plugins": {
"shell": {
"open": true
},
"fs": {
"all": true,
"scope": ["$RESOURCE/*"]
}
}
}
main.ts
import { readTextFile, BaseDirectory } from '@tauri-apps/plugin-fs';
const contents = await readTextFile('data.json', { dir: BaseDirectory.Resource });