This commit is contained in:
parent
556bb92481
commit
a6f43dc456
1 changed files with 9 additions and 3 deletions
|
@ -6,13 +6,19 @@ 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'],
|
||||||
|
minify: true,
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue