-
Notifications
You must be signed in to change notification settings - Fork 377
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
Adopt tanstack server fn plugin #1715
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 80c77a5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
More templates
commit: |
This is insanely cool. |
@brenelz , to make the CI green for the docs build, it's just a matter of adjusting the rollup config to avoid the AsyncLocalStorage error for the client bundle. You can move
Or have both for now like below: // docs/app.config.ts
import { defineConfig } from "@solidjs/start/config";
import tailwindcss from "tailwindcss";
import { config } from "vinxi/plugins/config";
export default defineConfig({
// experimental: { islands: true },
server: {
preset: "cloudflare_module",
alias: {
"_mime": "mime/index.js"
},
rollupConfig: {
external: ["__STATIC_CONTENT_MANIFEST", "node:async_hooks"]
}
},
vite: {
build: {
rollupOptions: {
external: ["__STATIC_CONTENT_MANIFEST", "node:async_hooks"]
}
},
plugins: [
config("tailwind", {
css: {
postcss: {
plugins: [tailwindcss]
}
}
} as any)
]
}
}); |
That's awesome!! Meanwhile I'm working on improving the test story around here so we can merge this more confidently. |
Since we don't have a test suite, the manual testing I've done here is to install the pkg.pr.new, and add the below to the Counter of the basic example, and set function useServer() {
"use server";
console.log("Counter Server Function", isServer) // <- returns True on server
}
export default function Counter() {
console.log("Counter Init", isServer) // <- returns False in client
useServer()
const [count, setCount] = createSignal(0);
return (
<button class="increment" onClick={() => setCount(count() + 1)} type="button">
Clicks: {count()}
</button>
);
} And it appear to work as expected both in |
I am wondering how easy it would be to test this out in one of my projects via npm link 🙈, or is there a chance we could publish this on some special name/tag to give it a try? |
@katywings , there is the pkg.pr.new link here - can you use that? |
@birkskyum I was just going to say the same thing. I haven't actually used it before but seems cool |
Just merged #1719 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E2E test passing. LGTM
@@ -0,0 +1,5 @@ | |||
--- | |||
"@solidjs/start": minor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was kinda expecting this one to be a patch since it's not changing any API nor is it adding a new feature.
wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommended the minor but I'm good with a patch too.
Testing this out right now, so far it doesn't work at all for me, most likely because it seems to have a completely different approach to decide which dependencies to externalize. Still figuring it out the details though. You gonna get a second analysis soon 😅 Edit: Yeah so it looks like this completely fails to externalize server libraries in the client bundling, resulting in errors during the build. Plus countless warnings for every node built-in module ( |
Here is a very basic reproduction of the missing externalization, this works in |
I wonder if this is a problem in this PR or a general thing with the Tanstack Server Functions plugin 🤔 - afaik @tannerlinsley mentioned that the Tanstack plugin actually should externalize more heavily than Vinxi and not less - so I assume this must be a problem on our side 🤔. |
There are externalization tests added to the test suite, so this PR should be rebased, and pass those. |
@katywings , next time you have a chance to check it, let us know if it fares better for you now with the externalization fixed. |
PR Checklist
I went deep to try and integrate Tanner's new Server Function plugin.
This was a proof of concept that seems to work.
Need someone more familiar with the code to take a look
PR Type
What kind of change does this PR introduce?