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

@solid-js/router working in build and preview but not in dev #4871

Closed
1 task done
AirBorne04 opened this issue Sep 26, 2022 · 6 comments · Fixed by #5059
Closed
1 task done

@solid-js/router working in build and preview but not in dev #4871

AirBorne04 opened this issue Sep 26, 2022 · 6 comments · Fixed by #5059
Assignees
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) ecosystem: external External library doesn't work

Comments

@AirBorne04
Copy link
Contributor

What version of astro are you using?

1.3.0

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

none

What package manager are you using?

pnpm

What operating system are you using?

Windows

Describe the Bug

When running the example simple routing with @solidjs/router example the workflow of astro build and astro preview is running fine. Running astro dev is failing with the error:

The requested module 'solid-js/web' does not provide an export named 'effect'

The error seems to originate from solid-js/web is imported with the server version which does not have an effect exported. I am struggling to find out why this is happening and how to work around it.

Link to Minimal Reproducible Example

https://github.com/AirBorne04/minimal-astro-cloudflare-solid.git

Participation

  • I am willing to submit a pull request for this issue.
@matthewp
Copy link
Contributor

Seems like this library is not intended to be used on the server. Can you use client:only or optionally only load it in an island when you know you are in the client?

@matthewp matthewp added the needs response Issue needs response from OP label Sep 26, 2022
@AirBorne04
Copy link
Contributor Author

I am just confused, why the build and preview works as expected, but not the dev? And therefore was wondering what the difference between those two configs are (though that is quite substantial i believe :) Having been digging around for the cloudflare adapter I realized that the platform for building solid needs to be node in order to make the router work. If it is browser it does import the wrong files.
I will do some more testing.

@DevHusariaSolutions
Copy link

DevHusariaSolutions commented Sep 27, 2022

Bro I faced 2 critical issues related to Astro in SolidJS cooperation. The truth is - Astro is more focused in React and Preact development, so SolidJS is like child from another family here :/ Astro is great and promising, but pararell evolving with such different framework plugins is not so eazy

@AirBorne04
Copy link
Contributor Author

@DevHusariaSolutions I mainly am trying to fix the ssr functionality at the moment. And while i totally get the focus on more widely used frameworks i see astro as a big opportunity for solid to shine. Also astro does save a lot of time in then project, therefore i am good with helping to improve it as well.

Astro is more focused in React and Preact development, so SolidJS is like child from another family

funny because to big extend netlify seems to be pushing both of them astro and solidjs

@matthewp matthewp removed the needs response Issue needs response from OP label Oct 6, 2022
@matthewp
Copy link
Contributor

matthewp commented Oct 6, 2022

@DevHusariaSolutions It's not true that Astro is focused on other frameworks. We treat all of our integrations equally.

Issues of the type: __ library doesn't work with ___ integration are really difficult to fix because they often require debugging the library itself to figure out what the problem is. Usually it comes down to a configuration issue.

These types of issues are best fixed by members of the respective communities who understand the context better. I would love to make Solid.js libraries work better in Astro, but I don't have the luxury of stopping everything I'm doing to solely focus on that.

I believe that Solid has more difficulties because libraries ship with untranspiled code. Vite 3 changed it so that dependencies are loaded through regular Node.js by default. This will cause any library that needs to be transpiled to fail. Using noExternal can fix that.

I'm not sure if that's the problem with this specific issue, however.

@matthewp matthewp added - P3: minor bug An edge case that only affects very specific usage (priority) ecosystem: external External library doesn't work labels Oct 6, 2022
@AirBorne04
Copy link
Contributor Author

I did play around with noExternal and it did have some effect but did not resolve the issue. Not sure somehow there is some wrong building happening, but couldn't figure out yet what exactly the issue is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) ecosystem: external External library doesn't work
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants