Closed bigjonroberts closed 1 year ago
Hi @bigjonroberts. Thanks for your detailed report. Looking at the logs, it seems both Fable 4 and Fable 2 (via fable-splitter) are being run, and the error actually comes from Fable 2 which doesn't support JSX (and many other things). Looking at the linked PR, I think you can totally replace Fable 2 by using the following scripts in package.json when invoking Fable.
{
"scripts": {
"dev": "dotnet fable App.fsproj -e .jsx --watch -o ./ --run next dev",
"build": "dotnet fable App.fsproj -e .jsx && next build",
}
}
You can remove the fable-compiler and fable-splitter dependencies. As they are not needed any more. Also, for React/NextJS to accept the functional components, they must start with uppercase. So after uncommenting the hello
function you need to change it to Hello
.
This worked! Thanks so much for your help @alfonsogarciacaro !!!
Description
I attempted integrating this in an example that send fable output to NextJS.
Repro code
Remove comments from lines 22-30 to see this in action. https://github.com/Neftedollar/Nextjs-Fable-simple-app/pull/2/files#diff-ca9363f15a16289ce46b600cbf6ff1d131100f78e7a370ffe4a5d476a54b103cR22-R30
Expected and actual results
Expected:
Actual:
Related information