Skip to content

Cannot import wasm as URL from a package which has exports field declared in package.json #6725

@sapphi-red

Description

@sapphi-red

Describe the bug

import path from '@sapphi-red/speex-preprocess-wasm/speex.wasm?url';

When writing the code above, the error below happens.

Error: Missing "./speex.wasm?url" export in "@sapphi-red/speex-preprocess-wasm" package

But since ?url is not a node.js spec so I think it should use ./speex.wasm instead of ./speex.wasm?url in exports field.

Reproduction

https://stackblitz.com/edit/js-9rbxxx?file=index.js

System Info

System:
    OS: Windows 10 10.0.19042
    CPU: (16) x64 AMD Ryzen 7 3700X 8-Core Processor
    Memory: 11.00 GB / 31.93 GB
  Binaries:
    Node: 16.13.2 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.17 - C:\Program Files\nodejs\yarn.CMD
    npm: 7.24.2 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (97.0.1072.76)
    Internet Explorer: 11.0.19041.1202
  npmPackages:
    vite: ^2.7.13 => 2.7.13

Used Package Manager

npm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions