mirror of
https://github.com/movie-web/extension.git
synced 2025-09-13 13:23:24 +00:00
Repo setup and build step configuration
This commit is contained in:
48
vite.config.ts
Normal file
48
vite.config.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
import { resolve, sep } from 'path'
|
||||
import { defineConfig } from 'vite'
|
||||
import { manifestMerge } from './plugins/manifest';
|
||||
import { viteStaticCopy } from 'vite-plugin-static-copy'
|
||||
|
||||
const staticAssets = [
|
||||
'src/assets/icons/16.png',
|
||||
]
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
manifestMerge({
|
||||
output: "manifest.json",
|
||||
files: [
|
||||
resolve(__dirname, 'src/assets/manifest.common.json'),
|
||||
resolve(__dirname, 'src/assets/manifest.chrome.json')
|
||||
]
|
||||
}),
|
||||
viteStaticCopy({
|
||||
targets: staticAssets.map(file => ({
|
||||
src: resolve(__dirname, file),
|
||||
dest: resolve(__dirname, file.replace(/^src/, 'dist')),
|
||||
}))
|
||||
})
|
||||
],
|
||||
root: "src",
|
||||
build: {
|
||||
minify: false,
|
||||
rollupOptions: {
|
||||
output: [{
|
||||
dir: "dist",
|
||||
format: "es",
|
||||
exports: "named",
|
||||
}],
|
||||
input: {
|
||||
popup: resolve(__dirname, 'src/popup.html'),
|
||||
worker: resolve(__dirname, 'src/index.ts'),
|
||||
},
|
||||
},
|
||||
outDir: 'dist',
|
||||
lib: {
|
||||
entry: resolve(__dirname, 'src/index.ts'), // needed for it to work at all
|
||||
fileName(format, entryName) {
|
||||
return entryName + ".js";
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
Reference in New Issue
Block a user