mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-07-22 14:48:41 +08:00
feat(desktop): add client extension points
This commit is contained in:
@@ -2,6 +2,25 @@ import { defineConfig } from 'vite'
|
||||
import react from '@vitejs/plugin-react'
|
||||
import path from 'path'
|
||||
|
||||
// '@product' resolves to the built-in default (empty). An alternate build
|
||||
// can set COW_PRODUCT_DIR to point at another module instead.
|
||||
const productDir =
|
||||
process.env.COW_PRODUCT_DIR || path.resolve(__dirname, 'src/renderer/src/product/default')
|
||||
|
||||
// When '@product' points outside this project, its files can't resolve shared
|
||||
// deps from their own tree. Alias the shared runtime deps to this project's
|
||||
// node_modules so an out-of-tree product module imports the same instances.
|
||||
const nodeModules = path.resolve(__dirname, 'node_modules')
|
||||
const sharedDepAliases = process.env.COW_PRODUCT_DIR
|
||||
? {
|
||||
react: path.join(nodeModules, 'react'),
|
||||
'react-dom': path.join(nodeModules, 'react-dom'),
|
||||
'react/jsx-runtime': path.join(nodeModules, 'react/jsx-runtime'),
|
||||
'react-router-dom': path.join(nodeModules, 'react-router-dom'),
|
||||
'lucide-react': path.join(nodeModules, 'lucide-react'),
|
||||
}
|
||||
: {}
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
root: path.resolve(__dirname, 'src/renderer'),
|
||||
@@ -17,6 +36,8 @@ export default defineConfig({
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': path.resolve(__dirname, 'src/renderer/src'),
|
||||
'@product': productDir,
|
||||
...sharedDepAliases,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user