Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dominikg opened this issue Dec 6, 2022 · 1 comment
Closed

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

dominikg opened this issue Dec 6, 2022 · 1 comment

Comments

@dominikg
Copy link
Member

dominikg commented Dec 6, 2022

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

@benmccann benmccann added this to the 4.x milestone Dec 6, 2022
@benmccann
Copy link
Member

this has been addressed in the version-4 branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants