Skip to content

Conversation

Andarist
Copy link

@Andarist Andarist commented Nov 18, 2024

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

For some reason, the preview deployment doesn't contain the updated code. 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

changeset-bot bot commented Nov 18, 2024

⚠️ No Changeset found

Latest commit: c61594b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@Rich-Harris
Copy link
Member

preview: https://svelte-dev-git-preview-svelte-14344-svelte.vercel.app/

this is an automated message

@paoloricciuti
Copy link
Member

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

For some reason, the preview deployment doesn't contain the updated code. 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>

Hey @Andarist thanks for the PR...however this repo is for the svelte-5-preview website which is not deployed anymore...i think you can make the same change on https://github.com/sveltejs/svelte.dev

Thanks again 😉

@Andarist
Copy link
Author

Here you go sveltejs/svelte.dev#872

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.

3 participants