Skip to content

Change esbuild platform to browser for the cloudflare adapter #1377

@ElioStalteri

Description

@ElioStalteri

platform: 'node' // TODO would be great if we could generate ESM and use type = "javascript"

the following is my current configuration

await esbuild.build({
    entryPoints: ['.svelte/cloudflare-workers/entry.js'],
    outfile: `${entrypoint}/index.js`,
    bundle: true,
    target: 'es2020',
    platform: 'browser' // TODO would be great if we could generate ESM and use type = "javascript"
});

this solves most of my problem when using supabase as they use websocket and other various things
when the project is compiled for node wrangler fail to build it as there is some require(...)

so my question is the following.
is there some reason on why we are using node instead of browser?
because from my understanding the cloudflare workers implements a browser like enviroment. so to me make sense to use a build that is compatible with the browser

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions