-
Notifications
You must be signed in to change notification settings - Fork 5
add: rspack with babeljs used via API for html-tag-js. #5
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
base: codemirror
Are you sure you want to change the base?
add: rspack with babeljs used via API for html-tag-js. #5
Conversation
Summary of ChangesHello @UnschooledGamer, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request focuses on a major overhaul of the project's build infrastructure by transitioning from Webpack to Rspack. The primary goal is to achieve substantial improvements in development compilation speed. This migration involves updating dependencies, configuring Rspack with new module rules, and implementing a custom loader to handle JSX transformations specifically for the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request successfully migrates the build system from Webpack to Rspack, which should yield significant performance improvements as noted in the description. The new rspack.config.js and the custom JSX loader are well-structured. However, I've identified a few issues that need attention. There's a critical bug in the Rspack configuration regarding loader order for .tsx files that will likely break the build. Additionally, there are some opportunities for cleanup and correctness improvements in the Rspack config and the custom loader. I also noticed an unrelated dependency removal in package.json that could have unintended side effects and should be clarified.
| "babel-loader": "^10.0.0", | ||
| "com.foxdebug.acode.rk.auth": "file:src/plugins/auth", | ||
| "com.foxdebug.acode.rk.customtabs": "file:src/plugins/custom-tabs", | ||
| "com.foxdebug.acode.rk.exec.proot": "file:src/plugins/proot", |
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.
The dependency com.foxdebug.acode.rk.exec.proot has been removed from devDependencies. This change seems unrelated to the migration to Rspack. This plugin appears to be related to proot execution, and removing it might break functionality for non-F-Droid builds. Was this removal intentional? If so, it would be beneficial to mention it in the pull request description with a justification.
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.
Greptile Overview
Greptile Summary
This PR migrates the build system from webpack to rspack for improved build performance. The changes include:
- New rspack configuration replacing webpack.config.js with rspack.config.js
- Custom JSX loader (
html-tag-jsx-loader.js) using Babel's parser API to transform JSX totag()calls for html-tag-js - Build script update to invoke rspack instead of webpack
- Performance improvement from ~28s (webpack) to 6-13s (rspack) for initial builds
The rspack configuration uses builtin SWC loader for TypeScript/JavaScript transpilation and a custom loader to transform JSX syntax to html-tag-js tag() function calls. Module CSS files are processed differently from regular CSS using the .m. prefix pattern.
Critical Issues Found:
- TypeScript loader order will cause JSX to be transformed by SWC before the custom loader can process it
- Invalid Babel parser plugin names will cause the parser to fail
These issues indicate the code was not successfully tested as claimed, since both would cause build failures.
Confidence Score: 0/5
- Not safe to merge - contains critical bugs that will cause build failures
- Two P0 bugs will definitely cause the build to fail: (1) TypeScript/TSX files will have JSX transformed by SWC before the custom loader can process it, breaking the html-tag-js transformation; (2) Invalid Babel parser plugin names will cause parsing errors. The PR description claims "100% tested" but these bugs prove otherwise - the build cannot succeed with this code.
- rspack.config.js (loader ordering), utils/custom-loaders/html-tag-jsx-loader.js (parser plugins)
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| rspack.config.js | 1/5 | Migration from webpack to rspack with new build configuration. Contains critical loader ordering bug in TypeScript/TSX processing that will cause JSX to be transformed before the custom loader can process it. |
| utils/custom-loaders/html-tag-jsx-loader.js | 2/5 | Custom loader using Babel API to transform JSX to tag() calls. Contains bug with invalid parser plugin names that will cause parsing to fail. |
| utils/scripts/build.sh | 5/5 | Updated build script to use rspack command instead of webpack. Change is minimal and correct - only script2 variable updated from 'webpack' to 'rspack'. |
| package.json | 4/5 | Added rspack packages, kept webpack for compatibility. Removed proot plugin from devDependencies (matches build.sh conditional logic). |
| package-lock.json | 5/5 | Lockfile updated to reflect dependency changes including rspack packages and their transitive dependencies. |
Sequence Diagram
sequenceDiagram
participant Build as Build Script
participant Rspack as Rspack
participant SWC as SWC Loader
participant Custom as html-tag-jsx-loader
participant Babel as Babel Parser/Transform
Build->>Rspack: rspack --mode development
Rspack->>Rspack: Load rspack.config.js
Note over Rspack: Process .tsx files
Rspack->>SWC: Load file (executes FIRST)
SWC->>SWC: Parse TypeScript + JSX (tsx: true)
SWC->>SWC: Transform JSX ❌ (should preserve)
SWC->>Custom: Pass transformed code
Custom->>Babel: Parse with Babel
Babel-->>Custom: Invalid parser plugins ❌
Note over Rspack: Process .js files
Rspack->>Custom: Load file (executes FIRST)
Custom->>Babel: Parse with invalid plugins ❌
Babel-->>Custom: Error
Note over Rspack: Expected flow for .tsx
Rspack->>SWC: Should preserve JSX
SWC->>Custom: Pass TypeScript→JS with JSX intact
Custom->>Babel: Transform JSX to tag()
Babel->>Custom: Return transformed code
Custom->>Rspack: JavaScript output
Greptile OverviewGreptile SummaryThis PR migrates the build system from Webpack to Rspack for improved build performance. The changes add Rspack dependencies, create a new Critical IssuesBuild-Breaking Syntax Errors:
Functional Logic Errors:
Performance & ArchitectureThe migration from Webpack to Rspack with SWC should provide significant performance improvements (PR description shows ~50% faster initial builds). The custom loader approach is reasonable for the html-tag-js transformation, though it would benefit from more robust edge case handling. The loader chain order (custom loader → SWC) is correct (loaders execute right-to-left), but the SWC configuration doesn't account for receiving already-transformed JSX, which needs to be fixed. Confidence Score: 0/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant Dev as Developer
participant Script as build.sh
participant Config as rspack.config.js
participant Rspack as Rspack Bundler
participant CustomLoader as html-tag-jsx-loader.js
participant SWC as SWC Loader
participant Output as www/build/
Dev->>Script: Run build.sh
Script->>Script: Parse arguments (mode, app, etc)
Script->>Script: Configure fdroid settings
Script->>Config: node ./utils/config.js
Script->>Rspack: rspack --mode [development|production]
Rspack->>Config: Load configuration
Config->>Rspack: Return module rules & plugins
Note over Rspack: Process .tsx? files
Rspack->>CustomLoader: Pass .tsx? source (right-to-left)
CustomLoader->>CustomLoader: Check for JSX syntax
alt Has JSX
CustomLoader->>CustomLoader: Parse with @babel/parser
CustomLoader->>CustomLoader: Transform JSX to tag() calls
CustomLoader->>CustomLoader: Add import tag if needed
CustomLoader->>SWC: Return transformed code
else No JSX
CustomLoader->>SWC: Pass through unchanged
end
SWC->>SWC: Parse TypeScript (tsx: true)
SWC->>SWC: Transform to ES2015
SWC->>Rspack: Return transpiled code
Note over Rspack: Process .m?js files
Rspack->>Rspack: Check oneOf rules
alt In node_modules
Rspack->>SWC: Process with SWC only
SWC->>Rspack: Return transpiled code
else Source files
Rspack->>CustomLoader: Pass source
CustomLoader->>CustomLoader: Transform JSX to tag()
CustomLoader->>SWC: Return transformed code
SWC->>Rspack: Return transpiled code
end
Note over Rspack: Process CSS/SCSS, assets, etc
Rspack->>Rspack: Apply remaining loaders
Rspack->>Output: Write bundled files
Script->>Script: cordova build android
|
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.
6 files reviewed, 6 comments
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
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.
7 files reviewed, 7 comments
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
|
@greptileai All seems good now. |
|
Great to hear! 🎉 The migration from webpack to rspack looks solid - that's a significant performance improvement you're seeing (28+ seconds down to 6-13 seconds). The custom HTML tag JSX loader and the overall rspack configuration appear to be working well. Thanks for thoroughly testing this on your device and providing those performance benchmarks. The improvement should make development much more pleasant for the team. |
This pull Request attempts to migrate away from webpack, instead it's using rspack.
Pull Request follows https://rspack.rs/guide/migration/webpack for migration guidance.
A significant amount of code was written by AI, including the
utils/custom-loaders/html-tag-jsx-loader.jsLoader to improve the performance and outputs.The code was 100% tested on my device.
With the dev mode compilation having (initial run):
Runs after the initial run are much faster, i.e 6s, 8s, etc.