grenierdev
grenierdev
CDCloudflare Developers
Created by grenierdev on 9/20/2023 in #workers-help
Bundling of remote dependencies
I'm trying to import a function from a package that is browser first. That is exports: { browser: "..." } in package.json. As a reproductible example, I'm trying to import from remote
import { importSPKI, importPKCS8 } from "https://cdnjs.cloudflare.com/ajax/libs/jose/4.13.1/key/import.js";
import { importSPKI, importPKCS8 } from "https://cdnjs.cloudflare.com/ajax/libs/jose/4.13.1/key/import.js";
Error given:
service core:user:discuspal: Uncaught Error: No such module "https:/cdnjs.cloudflare.com/ajax/libs/jose/4.13.1/key/import.js".
imported from "worker.js"
✘ [ERROR] MiniflareCoreError [ERR_RUNTIME_FAILURE]: The Workers runtime failed to start. There is likely additional logging output above.
service core:user:discuspal: Uncaught Error: No such module "https:/cdnjs.cloudflare.com/ajax/libs/jose/4.13.1/key/import.js".
imported from "worker.js"
✘ [ERROR] MiniflareCoreError [ERR_RUNTIME_FAILURE]: The Workers runtime failed to start. There is likely additional logging output above.
Is there any parameter to enable bundling these dependency or do I have to roll my own Custom Build (https://developers.cloudflare.com/workers/wrangler/custom-builds/) ? If I do, is there an example repo that does this? I know my way around esbuild and don't mind copy&past a plugin that I wrote that can bundle remote dependencies.
5 replies