Skip to content

Bundled .js accesses .wasm at the wrong URL #49

@shniubobo

Description

@shniubobo

I am using vite v6.3.2 with this plugin at v3.0.4.

When in dev mode, the wasm file can be correctly loaded. However, in the bundled js file, an additional "assets" segment is added to the URL. For example, foo.wasm is placed in assets/foo.wasm and should be accessed at that address, but the bundled js file tries to access it at assets/assets/foo.wasm instead.

I have tried the workaround in #43, but the serverPath option is deprecated and has no effect.

This is my vite.config.ts:

import { fileURLToPath, URL } from "node:url";

import tailwindcss from "@tailwindcss/vite";
import vue from "@vitejs/plugin-vue";
// @ts-expect-error No `.d.ts` available
import rust from "@wasm-tool/rollup-plugin-rust";
import { defineConfig } from "vite";
import vueDevTools from "vite-plugin-vue-devtools";

// https://vite.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    vueDevTools(),
    rust({
      experimental: {
        typescriptDeclarationDir: "../target/rollup-plugin-rust/",
      },
    }),
    tailwindcss(),
  ],
  resolve: {
    alias: {
      "@": fileURLToPath(new URL("./src", import.meta.url)),
    },
  },
  esbuild: {
    supported: {
      "top-level-await": true,
    },
  },
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions