Skip to content
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

"astro/loaders" import gives not available warning in VScode #12841

Closed
1 task
xkeshav opened this issue Dec 27, 2024 · 2 comments
Closed
1 task

"astro/loaders" import gives not available warning in VScode #12841

xkeshav opened this issue Dec 27, 2024 · 2 comments
Labels
needs repro Issue needs a reproduction

Comments

@xkeshav
Copy link
Contributor

xkeshav commented Dec 27, 2024

Astro Info

astro info
Astro                    v5.1.1
Node                     v22.0.0
System                   Linux (x64)
Package Manager          unknown
Output                   static
Adapter                  @astrojs/node
Integrations             astro-icon
                         @astrojs/tailwind
                         @astrojs/react
                         @astrojs/tailwind
                         astro-i18next

If this issue only occurs in one browser, which browser is a problem?

in VS Code

Describe the Bug

using new defienCollection method and taking refrence from (the official docs)[https://docs.astro.build/en/guides/content-collections/] and in the code spinnets it says

import { glob, file } from 'astro/loaders'; // Not available with legacy API

what this means? I have upgraded to astro 5.1.1 and related packages too

I am able to use it but it gives error in VS Code above the import statment

Cannot find module 'astro/loaders' or its corresponding type declarations.
There are types at '/home/project/name/node_modules/astro/dist/content/loaders/index.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'.

What's the expected result?

'astro/loaders' should not gives error in VS code

Link to Minimal Reproducible Example

image

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Dec 27, 2024
@xkeshav xkeshav changed the title "astro/loaders" not available to leagcy APi what it means? "astro/loaders" import gives not available warning in VScode Dec 27, 2024
@Princesseuh Princesseuh added the needs repro Issue needs a reproduction label Dec 27, 2024
Copy link
Contributor

Hello @xkeshav. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with needs repro will be closed if they have no activity within 3 days.

@github-actions github-actions bot removed the needs triage Issue needs to be triaged label Dec 27, 2024
@ematipico
Copy link
Member

ematipico commented Dec 28, 2024

You're defining an old content collection in a file that accepts only new content collections. This is illegal.

articles is an old content collection because it doesn't have a loader, and content.config.ts accepts only content collections that have loaders.

https://docs.astro.build/en/guides/upgrade-to/v5/#breaking-changes-to-legacy-content-and-data-collections

@ematipico ematipico closed this as not planned Won't fix, can't repro, duplicate, stale Dec 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs repro Issue needs a reproduction
Projects
None yet
Development

No branches or pull requests

3 participants