44 lines
960 B
JavaScript
44 lines
960 B
JavaScript
import { defineConfig } from 'vite';
|
|
import react from '@vitejs/plugin-react';
|
|
import path from 'path';
|
|
import pkg from './package.json';
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
plugins: [
|
|
react(),
|
|
{
|
|
name: 'html-transform',
|
|
transformIndexHtml(html) {
|
|
return html
|
|
.replace(/__appVersion__/g, pkg.version)
|
|
}
|
|
}
|
|
],
|
|
server:{
|
|
host: true,
|
|
allowedHosts: true,
|
|
cors: true,
|
|
hmr: true
|
|
},
|
|
optimizeDeps: {
|
|
include: ['react', 'react-dom'],
|
|
},
|
|
resolve: {
|
|
dedupe: ['react', 'react-dom'],
|
|
alias: {
|
|
'@src': path.resolve(__dirname, 'src'),
|
|
'@components': path.resolve(__dirname, 'components')
|
|
},
|
|
},
|
|
build: {
|
|
assetsDir: 'assets',
|
|
rollupOptions: {
|
|
output: {
|
|
entryFileNames: `assets/[name].[hash].js`,
|
|
chunkFileNames: `assets/[name].[hash].js`,
|
|
assetFileNames: `assets/[name].[hash].[ext]`,
|
|
},
|
|
},
|
|
}
|
|
});
|