-
Notifications
You must be signed in to change notification settings - Fork 134
Fix javascript builds now that we're using Workers/Worklets #520
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
Conversation
Feels so nice removing so much magic.
|
Claude finished @kixelated's task —— View job PR Review CompleteReviewed this pull request for bugs and security issues. Here are my findings: Tasks:
Issues Found:🐛 Critical Bug in DOM Helper - effect.cleanup(() => parent.removeChild(fragment));This will fail at runtime because
Recommendations:
Build System Changes:✅ The move from Vite bundling to TSC compilation looks correct. Worker/Worklet creation using |
|
Claude finished @kixelated's task —— View job PR Security & Bug ReviewTasks:
Issues Found:🐛 Critical Bug Still Present in DOM Helper - effect.cleanup(() => parent.removeChild(fragment));This bug from the previous review is still unfixed. When
Recommendations:
Build System Analysis:✅ The move from Vite bundling to TSC compilation looks correct. Worker/Worklet creation using ✅ The Worker implementations ( Verdict:❌ Cannot approve - Critical runtime bug and security concerns need to be addressed before this can be safely merged. |
Unfortunately, the simple days have come to an end. We were using worklets to capture audio but they were crudely being inlined as base64. Now that we're doing more complicated stuff in Workers and Worklets, it's time to do things properly.
When it comes to shipping a library, we need to produce JS files and associated TS types. There's two tools that I've used to do this:
The reason I switched from TSC to Vite was because of SolidJS and JSX. If you don't compile the JSX away, then importing libraries MUST set
jsxandjsxFactorysettings to match SolidJS which is just incompatible with React.However, using Vite introduces some new problems, because it produces worklets/workets in an
assetsfolder. An importer of the library would have to servenode_modules/@kixelated/hang/assetsas/assetsor have some way to configure the path. It's not the end of the world, but it's annoying.By reverting back to not compiling with a bundler, we can ship a library and rely on the application's bundler. This might require extra configuration but if we keep things simple, it should work out of the box with vite/webpack/parcel etc. They become responsible for building workers and worklets and performing any tree-shaking.
The only snag was the limited usage of JSX in the repo. This has been replaced with vanilla JS, using a tiny helper I created and my signals library. Personally, I think it's muuuuch nicer than SolidJS because it doesn't force functional programming. There's no magic, just append/remove DOM elements based on reactive signals. It should be just as fast, and faster than React of course.