Improve dev server with unified command and listhen integration#2566
Improve dev server with unified command and listhen integration#2566
Conversation
Co-authored-by: bookernath <8922457+bookernath@users.noreply.github.com>
|
@copilot instead of a direct cloudflare tunnel integration, can you use https://github.com/unjs/listhen instead which will give us tunneling as well as automatic port selection and so on? |
Co-authored-by: bookernath <8922457+bookernath@users.noreply.github.com>
Done! I've replaced the direct Cloudflare tunnel integration with listhen as requested. The changes include:
Listhen provides automatic port selection, built-in tunneling via untun/cloudflared, and better error handling with graceful fallbacks. The new implementation is more elegant and maintainable while providing the same functionality. Commit: cc82a8c Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
This PR enhances the development workflow by introducing a unified development server that combines webpack building, HTTP serving, and optional HTTPS tunneling in a single command using listhen.
Problem
The current development setup requires running two separate commands:
npm run dev- starts webpack in watch modenpm run dev:server- starts the HTTP serverThis creates friction in the development workflow and makes it difficult to test with live HTTPS websites that require secure connections.
Solution
New Development Commands
npm run dev:full- The new recommended development command that:npm run dev:tunnel- Enhanced development with HTTPS tunneling:dev:fullhttps://abc123.trycloudflare.comKey Features
npm run devandnpm run dev:servercommands remain unchangedUsage Examples
Custom Checkout Integration
The tunnel feature is particularly valuable for Custom Checkout development:
Simply copy the HTTPS auto-loader URL into your BigCommerce store's Checkout Settings.
Implementation Details
scripts/dev-server.js: Main unified server with webpack + listhen-based HTTP server + optional tunnelingscripts/test-dev-server.js: Validation script ensuring everything works correctlyThe solution maintains full backward compatibility while providing a significantly improved developer experience through listhen's elegant HTTP server capabilities, automatic port selection, and built-in tunneling support.
Benefits of Listhen Integration
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.