fix(solid-form): Add solid export condition#631
Conversation
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 80035f2. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 1 targetSent with 💌 from NxCloud. |
|
@lachlancollins can you investigate this? We'd want this to integrate with Vite Also CC @ryansolid if you have any guidance on how to do this (sorry for the ping Ryan) |
|
This is pretty much correct. We want the source, but not necessarily the TypeScript so we tend to tsc it into dist folder. My only recommendation is build it into a |
This is probably true but having the entrypoint be |
packages/solid-form/package.json
Outdated
| "test:lib:dev": "pnpm run test:lib --watch", | ||
| "test:build": "publint --strict", | ||
| "build": "vite build" | ||
| "build": "vite build && tsc -p tsconfig.build.json" |
There was a problem hiding this comment.
Leaving a comment here to remind @lachlancollins to investigate moving this into our Vite build if at all possible
There was a problem hiding this comment.
@crutchcorn I've tweaked the config slightly so that it generates a flatter structure. AFAIK, there is no need for the dist/source folder to have its own types, since they are identical to those in dist/esm (but if not, it can be re-enabled by removing "declaration": false).
I agree it might be nice to have a direct TS->JS copy of the source built by @tanstack/config, I'll have a look!
|
Is there anything blocking this from being merged? tanstack forms is unusable on solid without this |
|
@TheKnightCoder I'd like to see our build tooling unified to solve this problem before we merge. @lachlancollins any chance you could take another look into merging into Vite? Alternatively, if you think this fine to publish as-is for now and refine later, we can |
@tanstack/solid-formsolid export condition
|
Merging, per some research from @lachlancollins showing this should work now. Let us know if you run into additional problems around ESM/CJS support |
Solid relies on the solid export condition to perform a custom JSX transform depending on whether the code is being built for client or server, but
@tanstack/solid-formonly hasdist/cjsanddist/esm, which are client-only since they import stuff likememofromsolid-js/web(which is only available in client builds).To fix this I've added
tscto the build of process of@tanstack/solid-formso that.js/.jsxfiles are emitted which solid can apply its custom JSX transform on. There's probably nicer ways of doing this that can integrate with vite but this is what I did to fix a similar problem for SolidStart.