@sveltejs/adapter-cloudflare problem in a monorepo

I have a local workspace package that I import into my sveltekit project. Lets say this package has kysely and @libsql/kysely as its dependencies. Consuming this package results in a build failure like this:

Could not resolve "node:stream"                                                                                                                     
    .svelte-kit/output/server/entries/pages/(auth)/onboarding/_page.server.js:14:19:                                                                                                                     
      14 │ import stream from "node:stream";                                                                                                                                                             
         ╵                    ~~~~~~~~~~~~~                                                                                                                                                  
  The package "node:stream" 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.  
                           


Now if I pnpm install the dependencies of the workspace package directly to the sveltekit project, so in this case kysely and @libsql/kysely, the build is successful. This means that whenever sveltekit consumes a package, I would need to make sure that sveltekit has its dependencies explicitly installed as well.

I have confirmed this with a package that uses @aws-sdk as well. Build fails when @aws-sdk is not directly installed to sveltekit, works when it is installed.
Was this page helpful?