Skip to content

Astro is unable to load .data and .wasm file #16491

@thisisjaymehta

Description

@thisisjaymehta

Astro Info

Astro                    v5.18.1
Vite                     v6.4.1
Node                     v22.22.2
System                   Windows (x64)
Package Manager          npm
Output                   server
Adapter                  @astrojs/cloudflare (v12.6.13)
Integrations             @wix/astro (v2.34.0)
                         @wix/astro/auth
                         @wix/astro/monitor
                         @wix/astro/backend-extensions
                         @wix/astro/backoffice-extensions
                         @wix/astro/trusted-backoffice-extensions
                         @wix/astro/custom-elements
                         @wix/astro/html-embeds
                         @wix/astro/payment-links
                         @wix/astro/viewer-api
                         @wix/astro/embedded-scripts
                         @wix/astro/site-components
                         @wix/astro-site-component-panels-extensions
                         @wix/astro/viewer-services
                         @wix/astro/function-libraries
                         @wix/astro/context-providers
                         @wix/astro/robots
                         @astrojs/react (v4.4.2)
√ Copy to clipboard? ... no

If this issue only occurs in one browser, which browser is a problem?

All browsers

Describe the Bug

A package @needle-tools/usd uses .data and .wasm files.
But Astro gives this error when using this package:

node_modules/@needle-tools/usd/src/bindings/index.js:43:15: ERROR: No loader is configured for ".data" files: node_modules/@needle-tools/usd/src/bindings/emHdBindings.data?url

I tried adding a loader for it like this:

export default defineConfig({
  
  vite: {
    assetsInclude: ["**/*.data", "**/*.wasm"],
    optimizeDeps: {
      exclude: ["@needle-tools/usd"],
      esbuildOptions: {
        loader: {
          ".data": "file",
          ".wasm": "file",
        },
      },
    },
    ssr: {
      external: ["@needle-tools/usd"],
    },
  },
});

And even tried excluding from being scanned by esbuild.

But nothing works and I keep getting same error.

What's the expected result?

Expected result is for Astro to build without throwing this error

Link to Minimal Reproducible Example

I just want to know how to add loader properly in config for .data and .wasm files

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    - P3: minor bugAn edge case that only affects very specific usage (priority)pkg: cloudflareRelated to the Cloudflare adapter

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions