mtcute-repl/packages/worker/scripts/build-iframe-script.ts
alina sireneva 691896c3df
Some checks failed
Docs / build (push) Has been cancelled
build: fixed prod script build
2025-01-19 21:39:53 +03:00

23 lines
555 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[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'],
})