withastro / astro

The web framework for content-driven websites. ⭐️ Star to support our work!
https://astro.build
Other
43.84k stars 2.28k forks source link

Warning: astro:content is only supported running server-side. Using it in the browser will lead to bloated bundles and slow down page load. In the future it will not be supported. #11332

Closed ochronus closed 3 days ago

ochronus commented 3 days ago

Astro Info

Astro                    v4.11.0
Node                     v20.15.0
System                   macOS (arm64)
Package Manager          pnpm
Output                   static
Adapter                  none
Integrations             astro-expressive-code
                         astro-icon
                         @astrojs/tailwind
                         @astrojs/sitemap
                         @astrojs/mdx

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

Chrome, Brave, Edge, Firefox, Safari

Describe the Bug

I'm using astro for my statically generated blog. The site is working fine, but I'm getting the following warning in the console for every page:

astro:content is only supported running server-side. Using it in the browser will lead to bloated bundles and slow down page load. In the future it will not be supported.

Not sure what to do about this.

What's the expected result?

I expect no warnings.

Link to Minimal Reproducible Example

https://leadership.garden/

Participation

ematipico commented 3 days ago

You're probably importing your collections from a client-side component/script, triggering the warning.

You can keep using content collections like this, but your site will pull an incredible amount of data because content collections are meant to stay in your backend.

Please, next time share a valid reproduction. A website doesn't allow us to help you and debug any issue.