From their FAQ about dependencies in this case for js:
Can I use npm with Workers?
Workers has no explicit support for npm, but you can use any build tool or package manager you need to create your Worker script. Just upload to us the final, built, script with all dependencies included.