Skip to content

docs: improve lazy import example #14076

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 2 commits into from
Oct 31, 2024
Merged

docs: improve lazy import example #14076

merged 2 commits into from
Oct 31, 2024

Conversation

Rich-Harris
Copy link
Member

The language added in #13993 is a little confusing:

  • it's not a 'dynamic component', it's just a component
  • import() isn't a function, it's a function-like expression
  • the result of calling it is a module, not a component

Copy link

changeset-bot bot commented Oct 31, 2024

⚠️ No Changeset found

Latest commit: 188f0c0

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

Copy link

pkg-pr-new bot commented Oct 31, 2024

pnpm add https://pkg.pr.new/svelte@14076

commit: 188f0c0

@Conduitry
Copy link
Member

How do we feel about {#await import('./Component.svelte') then { default: Component }}?

@Rich-Harris
Copy link
Member Author

I thought about that... the only reason I didn't was that it's quite a lot to fit on one line if you're reading on mobile. But maybe that's okay? { default: Component } does have some clear advantages — pick your own name, and the syntax works on 3/4 as well as 5 (since <module.default> is an element in 3/4)

@Rich-Harris
Copy link
Member Author

I changed it

@Rich-Harris Rich-Harris merged commit 0ed914b into main Oct 31, 2024
10 checks passed
@Rich-Harris Rich-Harris deleted the fix-lazy-import-docs branch October 31, 2024 18:10
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