-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.js
More file actions
32 lines (31 loc) · 1.2 KB
/
Copy pathvite.config.js
File metadata and controls
32 lines (31 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { defineConfig } from 'vite'
import { fileURLToPath } from 'node:url'
import { crx } from '@crxjs/vite-plugin'
import manifest from './manifest.json' with { type: 'json' }
export default defineConfig({
plugins: [crx({ manifest })],
build: {
rollupOptions: {
input: {
popup: fileURLToPath(new URL('./index.html', import.meta.url)),
dashboard: fileURLToPath(new URL('./dashboard.html', import.meta.url)),
},
output: {
// Strip the internal repo basename from rollup-derived chunk / asset
// names so the literal string never leaks into dist/.
chunkFileNames: (chunkInfo) => {
const safe = (chunkInfo.name || 'chunk').replace(/bookmarkops-internal/g, 'bookmarkops')
return `assets/${safe}-[hash].js`
},
assetFileNames: (assetInfo) => {
const raw = assetInfo.name || ''
const safe = raw.replace(/bookmarkops-internal/g, 'bookmarkops')
if (!safe) return 'assets/[name]-[hash][extname]'
const dot = safe.lastIndexOf('.')
if (dot < 0) return `assets/${safe}-[hash]`
return `assets/${safe.slice(0, dot)}-[hash]${safe.slice(dot)}`
},
},
},
},
})