Add immer rewrite to server.go
Change-Id: If8c2e59d986501ec2bbf3d7850eebdc89e2551a1
diff --git a/polygerrit-ui/server.go b/polygerrit-ui/server.go
index e030878..ddfaeb4 100644
--- a/polygerrit-ui/server.go
+++ b/polygerrit-ui/server.go
@@ -202,6 +202,10 @@
moduleImportRegexp = regexp.MustCompile("(?m)^((import|export).*'/node_modules/)lit-(element|html).js';$")
data = moduleImportRegexp.ReplaceAll(data, []byte("${1}lit-${3}/lit-${3}.js';"))
+ // 'immer' imports and exports have to be resolved to 'immer/dist/immer.esm.js'.
+ moduleImportRegexp = regexp.MustCompile("(?m)^((import|export).*'/node_modules/)immer.js';$")
+ data = moduleImportRegexp.ReplaceAll(data, []byte("${1}/immer/dist/immer.esm.js';"))
+
if strings.HasSuffix(normalizedContentPath, "/node_modules/page/page.js") {
// Can't import page.js directly, because this is undefined.
// Replace it with window