build: fixed prod script build
Some checks failed
Docs / build (push) Has been cancelled

This commit is contained in:
alina 🌸 2025-01-19 21:39:53 +03:00
parent 556bb92481
commit 691896c3df
Signed by: teidesu
SSH key fingerprint: SHA256:uNeCpw6aTSU4aIObXLvHfLkDa82HWH9EiOj9AXOIRpI

View file

@ -6,13 +6,18 @@ config({
path: fileURLToPath(new URL('../../../.env', import.meta.url)), 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({ await build({
entryPoints: ['src/sw/iframe/script.ts'], entryPoints: ['src/sw/iframe/script.ts'],
bundle: true, bundle: true,
format: 'esm', format: 'esm',
outfile: 'src/sw/iframe/script-bundled.js', outfile: 'src/sw/iframe/script-bundled.js',
define: { define: defines,
'import.meta.env.VITE_HOST_ORIGIN': `"${process.env.VITE_HOST_ORIGIN}"`,
},
external: ['@mtcute/web'], external: ['@mtcute/web'],
}) })