2023-07-13 14:27:59 +00:00
|
|
|
import path from 'node:path'
|
2023-07-11 20:22:57 +00:00
|
|
|
import { defineConfig } from 'vite'
|
|
|
|
import react from '@vitejs/plugin-react'
|
2023-07-13 14:27:59 +00:00
|
|
|
import { crx } from '@crxjs/vite-plugin'
|
2023-07-11 20:22:57 +00:00
|
|
|
import Icons from 'unplugin-icons/vite'
|
2023-07-13 14:27:59 +00:00
|
|
|
import manifest from './manifest'
|
2023-07-13 17:07:14 +00:00
|
|
|
import packageJson from './package.json'
|
2023-07-11 20:22:57 +00:00
|
|
|
|
2023-07-15 15:11:56 +00:00
|
|
|
const isDev = process.env.NODE_ENV === 'development'
|
|
|
|
|
2023-07-13 14:27:59 +00:00
|
|
|
export default defineConfig({
|
2023-07-11 20:22:57 +00:00
|
|
|
resolve: {
|
|
|
|
alias: {
|
2023-07-13 17:07:14 +00:00
|
|
|
'@': path.resolve(__dirname, './src')
|
2023-07-11 20:22:57 +00:00
|
|
|
}
|
|
|
|
},
|
2023-07-13 17:07:14 +00:00
|
|
|
define: {
|
2023-07-15 15:11:56 +00:00
|
|
|
__DEV__: isDev,
|
2023-07-13 17:07:14 +00:00
|
|
|
__NAME__: JSON.stringify(packageJson.name)
|
|
|
|
},
|
2023-07-11 20:22:57 +00:00
|
|
|
plugins: [
|
|
|
|
react(),
|
|
|
|
// https://github.com/antfu/unplugin-icons
|
|
|
|
Icons({ compiler: 'jsx', jsx: 'react' }),
|
2023-07-23 20:10:04 +00:00
|
|
|
// @ts-expect-error use local package
|
|
|
|
crx({
|
|
|
|
manifest
|
|
|
|
})
|
2023-07-13 14:27:59 +00:00
|
|
|
]
|
|
|
|
})
|