Skip to content

Commit 015d583

Browse files
committed
Serve the extension from disk, not from hotreload server.
1 parent d4f160c commit 015d583

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

browser-extension/tests/har-view.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* - Injects Gitcasso content script in 'gitcasso' mode with location patching
1414
* - Location patching uses history.pushState to simulate original URLs
1515
* - Chrome APIs are mocked for extension testing outside browser context
16-
* - Content script is fetched from http://localhost:3000 (dev server)
16+
* - Extension assets served from `./output/chrome-mv3-dev` via `/chrome-mv3-dev` route
1717
*/
1818
import { error } from 'node:console'
1919
import fs from 'node:fs/promises'
@@ -236,6 +236,8 @@ app.get('/asset/:key/*', async (req, res) => {
236236
return res.status(404).send('Asset not found')
237237
}
238238
})
239+
// Serve extension assets from filesystem
240+
app.use('/chrome-mv3-dev', express.static(path.join(__dirname, '..', '.output', 'chrome-mv3-dev')))
239241

240242
app.listen(PORT, () => {
241243
console.log(`HAR Page Viewer running at http://localhost:${PORT}`)
@@ -262,7 +264,7 @@ function injectGitcassoScript(key: keyof typeof PAGES, html: string) {
262264
});
263265
264266
// Fetch and patch the content script to remove webextension-polyfill issues
265-
fetch('http://localhost:3000/.output/chrome-mv3-dev/content-scripts/content.js')
267+
fetch('/chrome-mv3-dev/content-scripts/content.js')
266268
.then(response => response.text())
267269
.then(code => {
268270
console.log('Fetched content script, patching webextension-polyfill...');

0 commit comments

Comments
 (0)