Skip to content

Commit f324a16

Browse files
committed
update manually specified package paths
1 parent 4ae5f87 commit f324a16

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

examples/signals/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"imports": {
1010
"dhtml": "../../dist/index.js",
1111
"dhtml/client": "../../dist/client.js",
12-
"alien-signals": "../../node_modules/alien-signals/esm/index.mjs"
12+
"alien-signals": "./node_modules/alien-signals/esm/index.mjs"
1313
}
1414
}
1515
</script>

scripts/test/browser-runtime.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import { serve } from '@hono/node-server'
22
import { serveStatic } from '@hono/node-server/serve-static'
33
import { transformSync } from 'amaro'
44
import { Hono } from 'hono'
5+
import * as path from 'node:path'
6+
import { fileURLToPath } from 'node:url'
57
import * as puppeteer from 'puppeteer'
68
import type { Runtime } from './main.ts'
79

@@ -13,23 +15,25 @@ export async function create_browser_runtime(): Promise<Runtime> {
1315

1416
const app = new Hono()
1517

16-
app.get('/@runner', c =>
17-
c.html(`
18+
app.get('/@runner', c => {
19+
const pkg = (specifier: string) => '/' + path.relative('.', fileURLToPath(import.meta.resolve(specifier)))
20+
21+
return c.html(`
1822
<!doctype html>
1923
<link rel="icon" href="data:" />
2024
<script type="importmap">${JSON.stringify({
2125
imports: {
2226
dhtml: '/dist/index.js',
2327
'dhtml/client': '/dist/client.js',
2428
'dhtml/server': '/dist/server.js',
25-
birpc: '/node_modules/birpc/dist/index.mjs',
26-
devalue: '/node_modules/devalue/index.js',
27-
mitata: '/node_modules/mitata/src/main.mjs',
29+
birpc: pkg('birpc'),
30+
devalue: pkg('devalue'),
31+
mitata: pkg('mitata'),
2832
},
2933
})}</script>
3034
<script type="module" src="/scripts/test/runtime.ts"></script>
31-
`),
32-
)
35+
`)
36+
})
3337

3438
app.use(async (c, next) => {
3539
await next()

0 commit comments

Comments
 (0)