Something went wrong. Try again.
Browser extension: detect and subscribe to standard.site publications on ATProto
Something went wrong. Try again.
1.2 kB · 28 lines
JavaScript
1234567891011121314151617181920212223242526272829// Watch mode for both build environments (see vite.config.ts) so dist/ stays// loadable while editing: clear dist/ once, then start a rollup watcher per// environment. emptyOutDir is turned off because watch mode would otherwise// re-empty dist/ on every rebuild, deleting the other environment's output.//// Watch builds are the dev channel by default (inverted icons, suffixed// name; see scripts/dev-channel.mjs), so this dist/ can be installed next to// the store build without the two being confusable. SUBSTANDARD_CHANNEL=release// npm run dev opts out.//// Usage: npm run dev — then load dist/ unpacked and reload the extension// in chrome://extensions after edits.
import { rmSync } from 'node:fs'import { resolve } from 'node:path'import { createBuilder } from 'vite'
process.env.SUBSTANDARD_CHANNEL ??= 'dev'
const root = resolve(import.meta.dirname, '..')rmSync(resolve(root, 'dist'), { recursive: true, force: true })console.log(`[dev] cleared dist/, channel ${process.env.SUBSTANDARD_CHANNEL}, starting watchers`)
const builder = await createBuilder({ root, build: { watch: {}, emptyOutDir: false },})await builder.buildApp() // starts a persistent rollup watcher per environment