build: fixed prod script build
All checks were successful
Docs / build (push) Successful in 2m21s

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

View file

@ -6,13 +6,19 @@ 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: {
'import.meta.env.VITE_HOST_ORIGIN': `"${process.env.VITE_HOST_ORIGIN}"`,
},
define: defines,
external: ['@mtcute/web'],
minify: true,
})