Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

perf(web): minify the final worker bundle (#911)

Gener5668f9e3af36
diff --git a/src/web/scripts/opennext-wrangler-config.test.ts b/src/web/scripts/opennext-wrangler-config.test.ts
index 8f50d2eac..9b7574311 100644
--- a/src/web/scripts/opennext-wrangler-config.test.ts
+++ b/src/web/scripts/opennext-wrangler-config.test.ts
@@ -74,6 +74,13 @@ describe("OpenNext and Wrangler refresh", () => {
expect(lockfile).not.toContain("'@opennextjs/[email protected]':")
})
+ it("minifies the Web Worker with keep_names disabled and bundling enabled", () => {
+ const webTopLevel = readRepositoryFile("src/web/wrangler.toml").split(/^[ \t]*\[/m)[0]
+ expect(webTopLevel.match(/^[ \t]*minify[ \t]*=.*$/gm)).toEqual(["minify = true"])
+ expect(webTopLevel.match(/^[ \t]*keep_names[ \t]*=.*$/gm)).toEqual(["keep_names = false"])
+ expect(webTopLevel).not.toMatch(/^[ \t]*no_bundle[ \t]*=[ \t]*true\b/m)
+ })
+
it("enables strict public global fetch without forbidden module registry flags", () => {
for (const path of ["src/web/wrangler.toml", "src/web/blog/wrangler.toml"]) {
const toml = readRepositoryFile(path)
diff --git a/src/web/src/test/e2e-ui/29-multi-device-read-state.spec.ts b/src/web/src/test/e2e-ui/29-multi-device-read-state.spec.ts
index 7743f2f76..1f1959e36 100644
--- a/src/web/src/test/e2e-ui/29-multi-device-read-state.spec.ts
+++ b/src/web/src/test/e2e-ui/29-multi-device-read-state.spec.ts
@@ -232,10 +232,10 @@ test("one human account converges read state across two browser profiles", async
await expect(deviceB.page.getByTestId(tid.inboxUnreadChannel(channelId))).toHaveCount(0)
await expect(deviceB.page.getByTestId(tid.inboxUnreadDm(dmId))).toHaveCount(0)
- await seedMessage("alice", channelId, `read-all channel ${stamp}`)
- await seedDmMessage("alice", dmId, `read-all dm ${stamp}`)
await gotoAfterUserWsAuth(deviceA.page, "/c/me/friends")
await gotoAfterUserWsAuth(deviceB.page, "/c/me/friends")
+ await seedMessage("alice", channelId, `read-all channel ${stamp}`)
+ await seedDmMessage("alice", dmId, `read-all dm ${stamp}`)
await deviceA.page.getByRole("button", { name: "Inbox" }).click()
await deviceB.page.getByRole("button", { name: "Inbox" }).click()
await expect(deviceA.page.getByRole("button", { name: "Mark all read" })).toBeEnabled()
diff --git a/src/web/src/test/e2e-ui/39-mobile-message-interactions.spec.ts b/src/web/src/test/e2e-ui/39-mobile-message-interactions.spec.ts
index 184390db6..d389d51be 100644
--- a/src/web/src/test/e2e-ui/39-mobile-message-interactions.spec.ts
+++ b/src/web/src/test/e2e-ui/39-mobile-message-interactions.spec.ts
@@ -978,6 +978,8 @@ test("mobile thread return uses server read state instead of tab-local pixel mem
const draft = `stable navigation draft ${stamp}`
await editable.fill(draft)
+ const scrollToPresent = alice.page.getByTestId(tid.scrollToPresent)
+ if (await scrollToPresent.isVisible()) await scrollToPresent.click()
const threadIndicator = alice.page.getByTestId(tid.threadIndicator(openerId))
await expect(threadIndicator).toBeVisible()
await threadIndicator.click()
diff --git a/src/web/wrangler.toml b/src/web/wrangler.toml
index d3bccfe8e..bbf581562 100644
--- a/src/web/wrangler.toml
+++ b/src/web/wrangler.toml
@@ -2,6 +2,7 @@ name = "alook-web"
main = "custom-worker.ts"
compatibility_date = "2026-09-07"
compatibility_flags = ["nodejs_compat", "global_fetch_strictly_public"]
+minify = true
# Disable esbuild keep_names — otherwise __name(...) wrappers leak into
# stringified inline scripts (ThemeScript, next-themes) and throw
# "__name is not defined" at runtime in the browser.