import { defineConfig } from 'vite'; import vue from '@vitejs/plugin-vue'; // or react from '@vitejs/plugin-react' if using React import wasm from 'vite-plugin-wasm'; import {createHtmlPlugin} from 'vite-plugin-html'; import fs from 'fs' import path from 'path' export default defineConfig({ optimizeDeps: { include: ['qrcode'] }, plugins: [ vue(), // or react() if using React wasm(), createHtmlPlugin({ minify: true, template: 'src/index.html', }), ], build: { outDir: 'dist', target: 'esnext', rollupOptions: { input: './src/index.ts', output: { entryFileNames: 'index.js', }, }, }, resolve: { alias: { '@': '/src', }, extensions: ['.ts', '.tsx', '.js'], }, server: { host: 'localhost', open: false, port: 3001, strictPort: true, // Empêche de changer de port si le 3001 est occupé hmr: { port: 9050, // Assure que le WebSocket HMR utilise bien le même port protocol: 'wss', } }, });