mtcute-repl/packages/worker/scripts/build-iframe-script.ts
alina sireneva a504823e53
All checks were successful
Docs / build (push) Successful in 2m14s
chore: upload sw script from runner iframe
hopefully this should fix firefox 🙏
2025-01-21 07:20:24 +03:00

26 lines
601 B
TypeScript

import { fileURLToPath } from 'node:url'
import { config } from 'dotenv'
import { build } from 'esbuild'
config({
path: fileURLToPath(new URL('../../../.env', import.meta.url)),
})
const defines: Record<string, string> = {}
for (const [key, value] of Object.entries(process.env)) {
if (key.startsWith('VITE_')) {
defines[`import.meta.env.${key}`] = JSON.stringify(value)
}
}
await build({
entryPoints: ['src/sw/iframe/script.ts'],
bundle: true,
format: 'esm',
outfile: 'src/sw/iframe/script-bundled.js',
define: defines,
external: [
'@mtcute/web',
],
minify: true,
})