Почему созданное мной окно в Tauri не видит TypeScript файлы?

В общем, при разработке tauri приложения всё было отлично (имеется в виду, при вызове команды npm run tauri dev), а в релизной версии (npm run tauri build) имеется проблема с typescript файлами, используемыми в созданном мною окне. Фрагмент кода, в котором создаётся данное окно:

#[tauri::command]
async fn open_input_window(handle: tauri::AppHandle) {
  println!("opening new window");
  let window: Window = match handle.get_window("text_input") {
    Some(window) => window,
    None => {
      tauri::WindowBuilder::new(
        &handle,
        "text_input",
        tauri::WindowUrl::App("text-input.html".into()))
          .build()
          .unwrap()
    }
  };
  window.show().unwrap();
}

tauri.conf:

{
  "build": {
    "beforeDevCommand": "npm run dev",
    "beforeBuildCommand": "npm run build",
    "devPath": "http://localhost:1420",
    "distDir": "../dist",
    "withGlobalTauri": true
  },
  "package": {
    "productName": "running-line-typescript",
    "version": "1.0.0"
  },
  "tauri": {
    "allowlist": {
      "dialog": {
        "all": true,
        "open": true,
        "save": true
      },
      "window": {
        "all": true,
        "create": true,
        "center": true,
        "requestUserAttention": true,
        "setResizable": true,
        "setTitle": true,
        "maximize": true,
        "unmaximize": true,
        "minimize": true,
        "unminimize": true,
        "show": true,
        "hide": true,
        "close": true,
        "setDecorations": true,
        "setAlwaysOnTop": true,
        "setSize": true,
        "setMinSize": true,
        "setMaxSize": true,
        "setPosition": true,
        "setFullscreen": true,
        "setFocus": true,
        "setIcon": true,
        "setSkipTaskbar": true,
        "setCursorGrab": true,
        "setCursorVisible": true,
        "setCursorIcon": true,
        "setCursorPosition": true,
        "setIgnoreCursorEvents": true,
        "startDragging": true,
        "print": true
      },
      "all": false,
      "shell": {
        "all": false,
        "open": true
      }
    },
    "bundle": {
      "active": true,
      "icon": [
        "icons/32x32.png",
        "icons/128x128.png",
        "icons/[email protected]",
        "icons/icon.icns",
        "icons/icon.ico"
      ],
      "identifier": "vladislav.laga.running-line",
      "targets": "all"
    },
    "security": {
      "csp": null
    },
    "updater": {
      "active": false
    },
    "windows": [
      {
        "fullscreen": false,
        "resizable": false,
        "title": "Бегущая строка",
        "width": 800,
        "height": 600
      }
    ]
  }
}

tsconfig.json:

{
  "compilerOptions": {
    "target": "ESNext",
    "module": "ESNext",
    "lib": [
      "ESNext",
      "DOM"
    ],
    "moduleResolution": "Node",
    "strict": true,
    "sourceMap": true,
    "resolveJsonModule": true,
    "esModuleInterop": true,
    "types": [
      "vite/client"
    ],
    "noEmit": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noImplicitReturns": true,
    "useUnknownInCatchVariables": false
  },
  "include": [
    "src/**/*"
  ]
}

vite.config.ts:

import { defineConfig } from "vite";

const mobile =
  process.env.TAURI_PLATFORM === "android" ||
  process.env.TAURI_PLATFORM === "ios";

// https://vitejs.dev/config/
export default defineConfig(async () => ({
  // Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`
  // prevent vite from obscuring rust errors
  clearScreen: false,
  // tauri expects a fixed port, fail if that port is not available
  server: {
    port: 1420,
    strictPort: true,
  },
  // to make use of `TAURI_DEBUG` and other env variables
  // https://tauri.studio/v1/api/config#buildconfig.beforedevcommand
  envPrefix: ["VITE_", "TAURI_"],
  build: {
    // Tauri supports es2021
    target: process.env.TAURI_PLATFORM == "windows" ? "chrome105" : "safari13",
    // don't minify for debug builds
    minify: !process.env.TAURI_DEBUG ? "esbuild" : false,
    // produce sourcemaps for debug builds
    sourcemap: !!process.env.TAURI_DEBUG,
  },
}));

а также предоставлю структуру файлов. Может, дело вообще в этом и файлы следует размещать совсем иначе: Структура

кстати, как я понял, vite компилирует typescript файлы в js, чтобы тот смог их прочитать. Вот как это выглядит в Index.html:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
<script type="module" crossorigin src="/assets/index-eacac9c2.js"></script>
<link rel="stylesheet" href="/assets/index-16aad44d.css">

но этого не происходит в созданном мною окне (text-input.html):

<script type="module" src="./src/ts/edit_text_field.ts"></script>

Если потребуется предоставить что-то ещё, то обязательно сделаю это) Буду благодарен любой помощи!


Ответы (0 шт):