#extra files and bundling question

1 messages · Page 1 of 1 (latest)

eternal jacinth
#

i have additional html files and i am using resolve to find and load, however, it's not finding it?

  const filePath = await resolve(
    "html",
    "config-panel.html"
  )

i suspect it is not bundling.

in dev mode if i do

  const filePath = await resolve(
    "..",
    "src"
    "html",
    "config-panel.html"
  )

it works, but obviously that is not reasonable.

mellow briar
#

These are files you've placed in the frontend src directory?

eternal jacinth
#

yes

#

all of my source files, with the exception of my license, are in src/ (i had to move the license file because it couldn't find it during windows bundling)

mellow briar
#

When building without a framework, anything in that directory is bundled into your app and is available to the frontend directly. For example, src/image.png would be <img src="/image.png>.

eternal jacinth
#

i do intend to use them as web files. it is loaded and read and is a part of my UI, just i don't want it inside my main index.html

  const {exists} = window.__TAURI__.fs
  info("Checking if config HTML file exists...")
  const configFilePath = await exists("html/config-panel.html")
  if(!configFilePath) {
    error("Config panel HTML file not found. Cannot initialize config.")
    return
  } else {
    info("Config panel HTML file found.")
  }
[2025-07-18][03:00:25][webview][INFO] Checking if config HTML file exists...
[2025-07-18][03:00:25][webview][ERROR] Config panel HTML file not found. Cannot initialize config.
mellow briar
#

The exists API is trying to read from the filesystem, not the app's bundled assets.

eternal jacinth
#

oh. that might also be why i can't read it because i'm using fs stuff. hmm.

#

which read operation would do so from the bundled stuff?

#

oh, can i fetch("html/file.html")?

mellow briar
#

Just a regular fetch should do.

eternal jacinth
#

ok this gives me some more context that is useful. maybe i can also solve my fonts issue in a better way

#

i'll give this a shot and report back 🙂

mellow briar
#

Anything inside the directory specified by tauri.conf.json's build > frontendDist is available to the frontend any time you have a window.

eternal jacinth
#

hmm ok that works, but it returns an entire document and my stuff is in the body. have to figure out how to DOMify it and grab the body.

mellow briar
#

Are these files meant to be modified by the end-user at all?

eternal jacinth
#

no, not even a little bit. it's the config dialog info for my app.

mellow briar
#

If you're just trying to load the page, you can use web-native window.location API.

eternal jacinth
#

oh, no, it's... uhh, i'm doing something gimmicky by doing a flyout config, i just don't want everything in my main index.html, so i load it from file.

#

and stuff it into a div