Skip to content

use 'browser' condition instead of 'node' to resolve ssr.mjs #8088

Closed
@dominikg

Description

@dominikg

Describe the problem

currently, svelte exports ssr.mjs for '.' when the 'node' condition is set.
This changes onMount to be a noop and allows treeshaking bundlers to remove browser-only code and imports from ssr bundles.

but using the 'node' condition can lead to problems, eg if something deno only used 'deno' condition, it would not get ssr.mjs.

It's also not in alignment with esm-env that is going to be used by sveltekit.

Describe the proposed solution

use the browser condition, like esm-env by @benmccann
https://github.com/benmccann/esm-env

Alternatives considered

leave it as is, assuming the node condition is used for non-browser builds always

Importance

would make my life easier

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