Core: Migrate from express to polka#29230
Conversation
Migrates away from express, instead using connect and the underlying node server directly. Both express and connect support the same middleware structure, which means most middleware packages work for both and have remained the same in this change. A few notes: - Express' router has been replaced by basic connect mount points (though the two are not equivalent exactly) - Express static has been replaced by sirv This trims a large sub-tree of dependencies from our packages which express was pulling in. We in fact use very little of the functionality express gives us, only really making use of the connect-style API anyway.
Migrates from express to polka 1.x.
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 6c3a0bb. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 1 targetSent with 💌 from NxCloud. |
|
@JReinhold this is where I got to with polka I may not have much time over the next few days, so if you do get time, feel free to use and push to this branch few things to note:
|
|
Thank you! 🙏 I'll make sure it gets over the finish line next week. |
express to polka
|
Couldn't test rsbuild because of rstackjs/storybook-rsbuild#136, but looking at the source it doesn't look like they're depending on any express-specific behavior in the Same story for Modern Web, they don't yet support Storybook 8 so I couldn't test it, but their https://github.com/modernweb-dev/web/blob/master/packages/storybook-builder/src/index.ts#L60-L133 |
There was a problem hiding this comment.
30 file(s) reviewed, 4 comment(s)
Edit PR Review Bot Settings
|
🎉 |

Closes #29083
What I did
Migrates from
expresstopolkaas the internal web server.Work in progress
Still WIP as there's some leftover changes from the old
connectbranch we can probably discard/revert now.Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
N/A yet
Documentation
MIGRATION.MD
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal,ci:mergedorci:dailyGH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli/src/sandbox-templates.tsMake sure this PR contains one of the labels below:
Available labels
bug: Internal changes that fixes incorrect behavior.maintenance: User-facing maintenance tasks.dependencies: Upgrading (sometimes downgrading) dependencies.build: Internal-facing build tooling & test updates. Will not show up in release changelog.cleanup: Minor cleanup style change. Will not show up in release changelog.documentation: Documentation only changes. Will not show up in release changelog.feature request: Introducing a new feature.BREAKING CHANGE: Changes that break compatibility in some way with current major version.other: Changes that don't fit in the above categories.🦋 Canary release
This pull request has been released as version
0.0.0-pr-29230-sha-6c3a0bb1. Try it out in a new sandbox by runningnpx storybook@0.0.0-pr-29230-sha-6c3a0bb1 sandboxor in an existing project withnpx storybook@0.0.0-pr-29230-sha-6c3a0bb1 upgrade.More information
0.0.0-pr-29230-sha-6c3a0bb1without-express-polka6c3a0bb11728379118)To request a new release of this pull request, mention the
@storybookjs/coreteam.core team members can create a new canary release here or locally with
gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=29230Greptile Summary
This PR migrates Storybook's internal web server from Express to Polka, aiming to reduce transitive dependencies and potentially improve performance.
code/core/src/core-server/dev-server.ts, updating server initialization and middleware usagesirvinstead ofexpress.staticin multiple files