20 lines
485 B
TypeScript
20 lines
485 B
TypeScript
import { define } from '../utils.ts'
|
|
import { bundle } from '@deno/emit'
|
|
import config from '../deno.json' with { type: 'json' }
|
|
|
|
export const handler = define.handlers(async (ctx) => {
|
|
const { code } = await bundle('./src/serviceworker/mod.ts', {
|
|
minify: true,
|
|
importMap: { imports: config.imports },
|
|
compilerOptions: {
|
|
inlineSourceMap: ctx.config.mode === 'development',
|
|
},
|
|
})
|
|
|
|
return new Response(code, {
|
|
headers: {
|
|
'Content-Type': 'text/javascript',
|
|
},
|
|
})
|
|
})
|