How to return a JavaScript file from a worker


I am very new to both node js and Cloudflare.

I have the following program that is also a npm package: maze3d/maze3d.js at main · michaelnicol/maze3d · GitHub

npm i maze3d

The issue is that a NPM package is only for server side and can’t be used client side. As a result, I was told to import from a CDN. This also prevents cros errors.

I set up a worker here:

However, I am wondering how I can put the above NPM package into this worker so it can be returned? I can use import * as maze3d from <link>

I found another CDN here:

This returns my github file as a string that I can then use eval() for. However, my request uses node js https module, which wont be on the client side.

If I do the following:

<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
 <script type="module">
     import * as maze3d from ""

I get that type module is not defined.

Where and how should I go from here?