2023-11-06 02:56:50 +08:00
|
|
|
import path from 'node:path'
|
2023-11-05 02:18:09 +08:00
|
|
|
import { defineConfig } from 'wxt'
|
|
|
|
|
import react from '@vitejs/plugin-react'
|
2024-09-27 13:53:50 +08:00
|
|
|
import { name, displayName, homepage } from './package.json'
|
2024-09-27 13:45:29 +08:00
|
|
|
import svgr from 'vite-plugin-svgr'
|
2025-05-21 21:18:29 +08:00
|
|
|
import tailwindcss from '@tailwindcss/vite'
|
2023-11-05 02:18:09 +08:00
|
|
|
|
|
|
|
|
export default defineConfig({
|
2023-11-06 02:56:50 +08:00
|
|
|
srcDir: path.resolve('src'),
|
2023-11-30 16:50:18 +08:00
|
|
|
imports: false,
|
2024-09-16 15:47:36 +08:00
|
|
|
entrypointsDir: 'app',
|
2025-05-21 21:18:29 +08:00
|
|
|
webExt: {
|
2025-10-01 22:44:53 +08:00
|
|
|
startUrls: ['http://www.example.com/'],
|
2025-09-30 18:53:24 +08:00
|
|
|
openDevtools: true
|
2023-11-05 02:18:09 +08:00
|
|
|
},
|
2024-09-30 21:39:47 +08:00
|
|
|
manifest: ({ browser }) => {
|
2024-09-29 15:34:10 +08:00
|
|
|
const common = {
|
|
|
|
|
name: displayName,
|
2024-10-16 02:00:24 +08:00
|
|
|
permissions: ['storage', 'notifications', 'tabs'],
|
2024-09-29 15:34:10 +08:00
|
|
|
homepage_url: homepage,
|
|
|
|
|
icons: {
|
|
|
|
|
'16': 'logo.png',
|
|
|
|
|
'32': 'logo.png',
|
|
|
|
|
'48': 'logo.png',
|
|
|
|
|
'128': 'logo.png'
|
2024-11-18 18:55:57 +08:00
|
|
|
},
|
|
|
|
|
action: {}
|
2024-09-27 13:45:29 +08:00
|
|
|
}
|
2024-09-29 15:34:10 +08:00
|
|
|
return {
|
|
|
|
|
chrome: {
|
|
|
|
|
...common
|
|
|
|
|
},
|
|
|
|
|
firefox: {
|
|
|
|
|
...common,
|
|
|
|
|
browser_specific_settings: {
|
|
|
|
|
gecko: {
|
|
|
|
|
id: 'molvqingtai@gmail.com'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}[browser]
|
2023-12-01 13:33:49 +08:00
|
|
|
},
|
2024-09-27 08:20:49 +08:00
|
|
|
vite: (env) => ({
|
2023-11-05 02:18:09 +08:00
|
|
|
define: {
|
2024-09-27 08:20:49 +08:00
|
|
|
__DEV__: env.mode === 'development',
|
2023-11-05 02:18:09 +08:00
|
|
|
__NAME__: JSON.stringify(name)
|
|
|
|
|
},
|
2024-09-27 13:45:29 +08:00
|
|
|
plugins: [
|
2025-09-30 18:53:24 +08:00
|
|
|
react({
|
|
|
|
|
babel: {
|
|
|
|
|
plugins: ['babel-plugin-react-compiler']
|
|
|
|
|
}
|
|
|
|
|
}),
|
2025-05-21 21:18:29 +08:00
|
|
|
tailwindcss(),
|
2024-09-27 13:45:29 +08:00
|
|
|
svgr({
|
|
|
|
|
include: '**/*.svg'
|
|
|
|
|
})
|
|
|
|
|
]
|
2023-11-05 02:18:09 +08:00
|
|
|
})
|
|
|
|
|
})
|