withastro / astro

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

`@preact/signals` not supported out of the box #4856

Closed natemoo-re closed 2 years ago

natemoo-re commented 2 years ago

What version of astro are you using?

16+

Are you using an SSR adapter? If so, which one?

None

What package manager are you using?

pnpm

What operating system are you using?

Mac

Describe the Bug

After installing @preact/signals, I needed to manually update my config to ensure @preact/signals is not externalized by Vite.

export default defineConfig({
  vite: {
    ssr: {
      noExternal: ['@preact/signals', 'preact', 'preact-render-to-string']
    }
  }
})

Repro works in StackBlitz but not locally

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-a863zh?file=src%2Fcomponents%2FCounter.tsx,astro.config.mjs

Participation

natemoo-re commented 2 years ago

You know what... I tried this yesterday and it didn't work. I tried it today and it worked. Maybe the new release of @preact/signals fixed this?

matthewp commented 2 years ago

We're going to revert https://github.com/withastro/astro/pull/4843 and update the preact/signals version there. It should be working once we do that.