How to publish a NPM package that utilizes SharedArrayBuffer?

15 Views Asked by At

Is it possible to create an npm package that utilizes a SharedArrayBuffer? I created a basic npm package locally that uses SharedArrayBuffer. Locally, the app runs as intended without any errors. However, once I publish it to npm and try to use it from unpkg.com CDN, I get "SharedArrayBuffer isn't defined." Can someone explain what is happening at this stage?

I tried to enable SharedArrayBuffer directly in Chrome by enabling it using these steps:

  1. Navigate to chrome://flags/.
  2. Click "I accept the risk".
  3. search for "shared".
  4. select "Enabled" for the option "Experimental enabled SharedArrayBuffer support in JavaScript".
  5. click "relaunch now".

However, that didn't work. Is there any way I can configure my NPM package to tell Chrome to allow the usage of SharedArrayBuffer?

0

There are 0 best solutions below