anthumchris / opus-stream-decoder

Instantly decode Ogg Opus audio streams in chunks with JavaScript & WebAssembly (Wasm)
124 stars 21 forks source link

Allow Usage from CDN #13

Open anthumchris opened 4 years ago

anthumchris commented 4 years ago

When referencing statically from a CDN like https://unpkg.com/opus-stream-decoder, the WASM file fetch fails because of the relative URL used to fetch.

<script src="https://unpkg.com/opus-stream-decoder@1.2.7/dist/opus-stream-decoder.js"></script>
dy commented 1 year ago

+1:

✘ [ERROR] Could not resolve "fs"

    node_modules/opus-stream-decoder/dist/opus-stream-decoder.mjs:9:1260:
      9 │ ...ry){if(!nodeFS)nodeFS=require("fs");if(!nodePath)nodePath=requir...
        ╵                                  ~~~~

  The package "fs" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "--platform=node" to do that, which will remove this error.

✘ [ERROR] Could not resolve "path"

    node_modules/opus-stream-decoder/dist/opus-stream-decoder.mjs:9:1296:
      9 │ ...f(!nodePath)nodePath=require("path");filename=nodePath["normaliz...
        ╵                                 ~~~~~~

  The package "path" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "--platform=node" to do that, which will remove this error.