110 lines
2.5 KiB
TypeScript
110 lines
2.5 KiB
TypeScript
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
import pxtovw from 'postcss-px-to-viewport-8-plugin'
|
|
import { resolve as resolvePath } from 'path'
|
|
import resolve from 'vite-plugin-resolve';
|
|
const loder_pxtovw = pxtovw({
|
|
viewportWidth: 1900,
|
|
viewportUnit: 'vw',
|
|
selectorBlackList: ['.login', '.ant-pagination']
|
|
})
|
|
|
|
export default defineConfig({
|
|
css: {
|
|
postcss: {
|
|
// plugins: [loder_pxtovw],
|
|
},
|
|
},
|
|
server: {
|
|
host: '0.0.0.0',
|
|
proxy: {
|
|
|
|
}
|
|
},
|
|
resolve: {
|
|
alias: [
|
|
{
|
|
find: '@',
|
|
replacement: resolvePath(__dirname, 'src'),
|
|
},
|
|
],
|
|
},
|
|
build: {
|
|
minify: 'terser',
|
|
terserOptions: {
|
|
compress: {
|
|
drop_console: true,
|
|
},
|
|
},
|
|
rollupOptions: {
|
|
output: {
|
|
chunkFileNames: 'assets/js/[name]-[hash].js',
|
|
entryFileNames: 'assets/js/[name]-[hash].js',
|
|
assetFileNames: 'assets/[ext]/[name]-[hash].[ext]',
|
|
compact: true,
|
|
manualChunks: {
|
|
|
|
}
|
|
},
|
|
}
|
|
},
|
|
base: './', // 这里更改打包相对绝对路径
|
|
plugins: [
|
|
react(),
|
|
resolve({
|
|
'agora-electron-sdk': `
|
|
const {
|
|
createAgoraRtcEngine,
|
|
ChannelProfileType,
|
|
ClientRoleType,
|
|
RenderModeType,
|
|
ScreenCaptureSourceType,
|
|
VideoSourceType,
|
|
VideoViewSetupMode,
|
|
AudioAinsMode,
|
|
SimulcastStreamMode,
|
|
VideoStreamType,
|
|
RtcConnection,
|
|
RtcStats,
|
|
AudioVolumeInfo,
|
|
UserOfflineReasonType,
|
|
ConnectionStateType,
|
|
ConnectionChangedReasonType,
|
|
LocalVideoStreamState,
|
|
LocalVideoStreamReason,
|
|
BeautyOptions,
|
|
ColorEnhanceOptions,
|
|
LowlightEnhanceOptions,
|
|
VirtualBackgroundSource,
|
|
AudienceLatencyLevelType
|
|
} = require("agora-electron-sdk")
|
|
export {
|
|
createAgoraRtcEngine,
|
|
ChannelProfileType,
|
|
ClientRoleType,
|
|
RenderModeType,
|
|
ScreenCaptureSourceType,
|
|
VideoSourceType,
|
|
VideoViewSetupMode,
|
|
AudioAinsMode,
|
|
SimulcastStreamMode,
|
|
VideoStreamType,
|
|
RtcConnection,
|
|
RtcStats,
|
|
AudioVolumeInfo,
|
|
UserOfflineReasonType,
|
|
ConnectionStateType,
|
|
ConnectionChangedReasonType,
|
|
LocalVideoStreamState,
|
|
LocalVideoStreamReason,
|
|
BeautyOptions,
|
|
ColorEnhanceOptions,
|
|
LowlightEnhanceOptions,
|
|
VirtualBackgroundSource,
|
|
AudienceLatencyLevelType
|
|
}
|
|
`,
|
|
})
|
|
]
|
|
})
|