feat!: replace express with connect as default server - #143
Conversation
Summary of ChangesHello, 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 refactors the default development server to use Connect instead of Express. This change aims to reduce the server's footprint and dependencies, as Connect provides a more minimal middleware pipeline while maintaining a compatible interface for basic use cases. The update includes modifications to dependencies, type definitions, and documentation to reflect this transition. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
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.
Code Review
This pull request refactors the dev server to use connect instead of express by default, which is a great move for reducing dependencies and aligning with other tools like Vite and Rsbuild. The changes are well-executed across the documentation, dependencies, and source code. I've found a couple of areas for improvement regarding dependency management and type safety. My detailed feedback is in the comments below.
There was a problem hiding this comment.
Pull request overview
This PR replaces Express with Connect as the default application for the dev server. The motivation is that Connect is significantly smaller and has fewer dependencies than Express, while providing the same (req, res, next) middleware interface that the dev server actually needs.
Changes:
- Swaps
expressfromdependenciestodevDependencies(only needed for testing custom app scenarios), addsconnectandserve-staticas new explicitdependencies - Replaces all Express-specific types (
ExpressApplication,ExpressRequest, etc.) with Connect equivalents and simplifiesMiddlewareHandlerto a generic function type - Updates the default app creation from
getExpress()()togetConnect()(), replacesgetExpress().static(...)with standalonegetServeStatic()(...), and updates the test foronListeningto use the connect-compatibleapp.use()instead ofapp.get()/app.post()
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/server.ts |
Replaces getExpress with getConnect and getServeStatic; updates type defaults from ExpressApplication to ConnectApplication |
src/types.ts |
Imports connect types, removes Express-specific type imports, simplifies MiddlewareHandler, MiddlewareObject, and Middleware |
package.json |
Moves express to devDependencies, adds connect, serve-static, and @types/connect to dependencies |
pnpm-lock.yaml |
Reflects updated dependency graph |
rslib.config.ts |
Replaces express external with connect and serve-static externals |
tests/e2e/on-listening.test.js |
Updates route handler from Express-specific app.get()/app.post() to connect-compatible app.use() with manual method checking |
docs/migrate-v1-to-v2.md |
Documents the breaking change and provides migration guidance for users relying on Express-specific APIs |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Use Connect instead of Express for the default dev server.
The dev server only needs a minimal middleware pipeline. Connect provides the same
(req, res, next)interface as Express while being significantly smaller and having fewer dependencies, making it a better fit for this use case.webpack/webpack-dev-server#4741 (comment)