#day 1 noob problem - I can't seem to import anything at all from "@tauri-apps/api/"

8 messages · Page 1 of 1 (latest)

midnight siren
#

I'm just playing with a basic js app with npm, and the tauri api docs show the import syntax as, e.g. import { writeTextFile, BaseDirectory } from '@tauri-apps/api/fs'; I'm out of ideas - this is the inspect console error: TypeError: Module specifier, '@tauri-apps/api/fs' does not start with "/", "./", or "../". Prefixing with "/" or "./" does not help. Using "/@tauri-apps ..." gives a new error: TypeError: 'text/html' is not a valid JavaScript MIME type (same for "./@tauri-apps"). I'm discouraged. What the heck is going on?

fathom pilot
#

are you using a Javascript bundler or frontend tool like Vite or Webpack?

#

Because that import only works within a bundler environment (the bundler then takes your JS files and turns them into optimized JS files the browser actually understands)

lyric quartz
#

There's a lot of assumptions in this framework 🤔

midnight siren
midnight siren