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

Update Solid ecosystem package logic to include packages with peerDep… #6934

Merged
merged 3 commits into from
May 2, 2023

Conversation

matthewp
Copy link
Contributor

… of Solid

Changes

Testing

Tested in the example project

Docs

N/A

@changeset-bot
Copy link

changeset-bot bot commented Apr 28, 2023

🦋 Changeset detected

Latest commit: 80d447f

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added pkg: solid Related to Solid (scope) pkg: integration Related to any renderer integration (scope) labels Apr 28, 2023
@@ -8,7 +8,7 @@ export async function getSolidPkgsConfig(isBuild: boolean, astroConfig: AstroCon
isBuild,
viteUserConfig: astroConfig.vite,
isFrameworkPkgByJson(pkgJson) {
return containsSolidField(pkgJson.exports || {});
return containsSolidField(pkgJson.exports || {}) || !!(pkgJson.peerDependencies || {})['solid-js'];
Copy link
Member

@Princesseuh Princesseuh May 1, 2023

Choose a reason for hiding this comment

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

The logic here is a tiny bit hard to read with the numerous pipes. Reviewing this, I was actually confused that the code added was in the parameter of containsSolidField and it took me a few reads before getting the logic and that it wasn't a parameter. Maybe a comment could help?

I normally wouldn't bother, but since we get comments after not understanding external stuff often, I figure it's worth having a comment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that's very true. I'm actually going to hold off on this one until I have a chance to speak with @bluwy because maybe making all packages with a peerDep isn't the right call here. Might just want to hardcode this one instead.

Copy link
Member

Choose a reason for hiding this comment

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

We'd probably want to align with vite-plugin-solid's implementation too, so I think we should avoid this as the package would also have issues in other Vite SSR Solid setups.

Maybe a solution is to remove the solid-js string here:

noExternal: ['solid-js', ...solidPkgsConfig.ssr.noExternal],

Or only apply it in dev.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds reasonable since that's what vite-plugin-solid does. I've update the PR to remove 'solid' as a noExternal, seems to work from my testing.

Copy link
Member

@bluwy bluwy left a comment

Choose a reason for hiding this comment

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

LGTM. Looks like the tests pass too.

"@astrojs/solid-js": patch
---

Update Solid ecosystem package logic to include packages with peerDep of Solid
Copy link
Member

Choose a reason for hiding this comment

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

This probably needs to be changed with the new PR changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: integration Related to any renderer integration (scope) pkg: solid Related to Solid (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Astro loads two copies of SolidJS
3 participants