55 lines
1.0 KiB
TypeScript
55 lines
1.0 KiB
TypeScript
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
import pxtovw from 'postcss-px-to-viewport-8-plugin'
|
|
import { resolve } from 'path'
|
|
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: resolve(__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(),
|
|
],
|
|
})
|