Help Understanding the Preact Codebase and Dev Workflow #4758
-
Hey, hi! I've reached out to a few people but haven’t received any replies. I thought this would be my last resort to ask for help. Here’s my question in simple terms: How do I understand the Preact codebase? To elaborate: I’ve found the source files for core methods like My plan was to:
However, that didn’t work — I ran into CORS issues, and couldn’t figure out how to correctly map the output to I also tried a similar approach with the React codebase — no luck there either. What really sparked my curiosity is seeing how Preact internally reuses logic — like implementing I’m eager to learn and dig deep into the internals of Preact. Any help or direction would mean a lot! Thanks so much for maintaining such a great library. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 8 replies
-
There are two ways to work in this repository, you have the Secondly you can develop through tests, in every repository you can just look at I personally debug libraries with
it's a small code base, starting from the start is all you need I reckon, start from I don't know where you reached out but I didn't see anything, feel free to reach out to me on our slack. |
Beta Was this translation helpful? Give feedback.
-
Thanks a lot!!! @JoviDeCroock I'll come back with an article like “Walkthrough: Building Your Own Preact” after I understand the concepts well. |
Beta Was this translation helpful? Give feedback.
-
I tried adding console.log at the start of the diff method and faced two issues:
|
Beta Was this translation helpful? Give feedback.
-
useful for objects. but spread operators are not helpful to view DOM elements, right? correct me if i'm wrong. |
Beta Was this translation helpful? Give feedback.
There are two ways to work in this repository, you have the
demo/
folder which you can runnpm i && npm run dev
in. This will contain a live copy of the files within the repo so any console.log will show up. This is tested in browser etc as described in point 2.Secondly you can develop through tests, in every repository you can just look at
package.json.scripts
to find out what commands you can run.npm run test:vitest
is one of ours.I personally debug libraries with
demo/
and solve Preact specific issues with tests running, I write a new test and solve the issue.it's a small code base, starting from the sta…