Skip to content

fix: resolve module and browser conditions for fetched packages in REPL #872

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

Merged
merged 1 commit into from
Nov 25, 2024

Conversation

Andarist
Copy link
Contributor

I believe both of those should be added here:

  • module is meant to help avoid dual package hazards because it allows both require and import to resolve to it and instantiate only a single instance of the package. Even though REPL is not a bundler, I don't see why this would not be something that you'd like to support here. It's legit for import to point to an .mjs wrapper for the CJS content and this field can be used to point resolvers directly to ESM bundles
  • browser - you already configure browser: true but, according to the docs, that just enables support for the browser field (package.json#browser). The proposed change should also add it to supported exports conditions

I verified manually that it fixes this REPL code:

<script>
	import {setup} from "xstate"
	let name = setup({}).createMachine({ context: { name: 'world!' } }).getInitialSnapshot().context.name;
</script>

<h1>Hello {name}!</h1>

Copy link

vercel bot commented Nov 18, 2024

@Andarist is attempting to deploy a commit to the Svelte Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

vercel bot commented Nov 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
svelte-dev ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 18, 2024 5:45pm

Copy link
Member

@dummdidumm dummdidumm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you!

@dummdidumm dummdidumm merged commit 0b7a0cb into sveltejs:main Nov 25, 2024
5 checks passed
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

Successfully merging this pull request may close these issues.

2 participants