You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
import { defineConfig } from 'vite'
|
|
|
|
import react from '@vitejs/plugin-react'
|
|
|
|
import WindiCSS from 'vite-plugin-windicss'
|
|
|
|
|
|
|
|
const buildDatePlugin = () => {
|
|
|
|
return {
|
|
|
|
transformIndexHtml(html) {
|
|
|
|
const dataString = new Date().toISOString()
|
|
|
|
return html.replace(
|
|
|
|
/%BUILD_DATE%/,
|
|
|
|
`${dataString}`,
|
|
|
|
)
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// https://vitejs.dev/config/
|
|
|
|
export default defineConfig({
|
|
|
|
plugins: [react(), WindiCSS(), buildDatePlugin()],
|
|
|
|
server: {
|
|
|
|
host: "0.0.0.0",
|
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
alias: {
|
|
|
|
"@": "/src",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
build: {
|
|
|
|
sourcemap: true,
|
|
|
|
manifest: true,
|
|
|
|
chunkSizeWarningLimit: 555,
|
|
|
|
// rollupOptions: {
|
|
|
|
// output: {
|
|
|
|
// manualChunks(id) {
|
|
|
|
// if (id.includes('node_modules')) {
|
|
|
|
// return id.toString().split('node_modules/')[1].split('/')[0].toString();
|
|
|
|
// }
|
|
|
|
// },
|
|
|
|
// chunkFileNames: (chunkInfo) => {
|
|
|
|
// const facadeModuleId = chunkInfo.facadeModuleId ? chunkInfo.facadeModuleId.split('/') : [];
|
|
|
|
// return `assets/[name].[hash].js`;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
},
|
|
|
|
terserOptions: {
|
|
|
|
maxWorkers: 4
|
|
|
|
}
|
|
|
|
})
|