Skip to content

Additional import.meta.glob fixes#10315

Merged
yanthomasdev merged 2 commits into
mainfrom
theotterlord/glob-updates
Dec 9, 2024
Merged

Additional import.meta.glob fixes#10315
yanthomasdev merged 2 commits into
mainfrom
theotterlord/glob-updates

Conversation

@TheOtterlord
Copy link
Copy Markdown
Member

Fixes 2 more instances of import.meta.glob

@TheOtterlord TheOtterlord added the improve or update documentation Enhance / update existing documentation (e.g. add example, improve description, update for changes) label Dec 9, 2024
@netlify
Copy link
Copy Markdown

netlify Bot commented Dec 9, 2024

Deploy Preview for astro-docs-2 ready!

Name Link
🔨 Latest commit 9a974eb
🔍 Latest deploy log https://app.netlify.com/sites/astro-docs-2/deploys/675710ca4301d6000754a172
😎 Deploy Preview https://deploy-preview-10315--astro-docs-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@astrobot-houston
Copy link
Copy Markdown
Contributor

astrobot-houston commented Dec 9, 2024

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

File Note
en/guides/imports.mdx Source changed, localizations will be marked as outdated.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

default: Record<string, any>;
}
const data = await import.meta.glob<CustomDataFile>('../data/**/*.js');
const data = import.meta.glob<CustomDataFile>('../data/**/*.js');
Copy link
Copy Markdown
Member

@sarah11918 sarah11918 Dec 9, 2024

Choose a reason for hiding this comment

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

Just checking, normally we've been removing await when there is eager loading! And, this doesn't need the Object.values?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

await is removed because import.meta.glob never returns a promise, but it returns a record of functions that return promises when called. There's no usage example, and we can't showcase this easily, but whether someone needs eager: true will probably come down to what they're importing and why. The Vite docs cover what eager does, and we link to that above.

Copy link
Copy Markdown
Member

@sarah11918 sarah11918 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 for the fix!

@TheOtterlord TheOtterlord added the Merge Queue Approved and ready to be merged (wait for feature release if also labelled M-O-R)! label Dec 9, 2024
@yanthomasdev yanthomasdev merged commit 0d7da61 into main Dec 9, 2024
@yanthomasdev yanthomasdev deleted the theotterlord/glob-updates branch December 9, 2024 16:00
ArmandPhilippot added a commit to ArmandPhilippot/astro-docs that referenced this pull request Dec 9, 2024
ArmandPhilippot added a commit to ArmandPhilippot/astro-docs that referenced this pull request Dec 10, 2024
thomasbnt added a commit that referenced this pull request Dec 11, 2024
* i18n(fr): update all the `migrate-to` guides

Signed-off-by: Armand Philippot <git@armand.philippot.eu>

* i18n(fr): update `guides/imports.mdx`

See #9240, #10140, #10310 and #10315

* farewell `Astro.glob`

* fix wrong locale

* fix bold text

Co-authored-by: Thomas Bonnet <thomasbnt@protonmail.com>

* remove useless await

see #10332

---------

Signed-off-by: Armand Philippot <git@armand.philippot.eu>
Co-authored-by: Thomas Bonnet <thomasbnt@protonmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improve or update documentation Enhance / update existing documentation (e.g. add example, improve description, update for changes) Merge Queue Approved and ready to be merged (wait for feature release if also labelled M-O-R)!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants