update HMR to support kjol

This commit is contained in:
2026-07-09 12:49:17 -04:00
parent c8fe422b4e
commit a0c5f73b64
3 changed files with 135 additions and 29 deletions

View File

@@ -13,7 +13,6 @@ import (
"encoding/json"
"fmt"
"net/http"
"path/filepath"
"strings"
esbuild "github.com/evanw/esbuild/pkg/api"
@@ -71,17 +70,16 @@ func (d *devServer) serveVendor(w http.ResponseWriter, r *http.Request) {
// re-externalizing the OTHER vendored specifiers so they resolve (once) through
// the import map. Mirrors the prod vendor resolution (NodePaths + development
// condition) so the dev copy matches the shipped one.
func (d *devServer) bundleVendor(relFile string) ([]byte, error) {
entry := filepath.Join(d.vendor, filepath.FromSlash(relFile))
func (d *devServer) bundleVendor(absFile string) ([]byte, error) {
result := esbuild.Build(esbuild.BuildOptions{
EntryPoints: []string{entry},
EntryPoints: []string{absFile},
Bundle: true,
Write: false,
Format: esbuild.FormatESModule,
Target: esbuild.ES2022,
Platform: esbuild.PlatformBrowser,
Conditions: []string{"development"},
NodePaths: []string{d.vendor},
NodePaths: d.vendorDirs,
Sourcemap: esbuild.SourceMapInline,
LogLevel: esbuild.LogLevelSilent,
Plugins: []esbuild.Plugin{d.vendorSharedExternalPlugin()},