| 1 | // Built as one classic script and one stylesheet beside a hand-written ../viewer/index.html: in a frame with |
| 2 | // sandbox="allow-scripts" the page's origin is opaque, and module scripts would load only with CORS headers. |
| 3 | import react from '@vitejs/plugin-react'; |
| 4 | import { defineConfig } from 'vite'; |
| 5 | |
| 6 | export default defineConfig({ |
| 7 | plugins: [react()], |
| 8 | base: './', |
| 9 | define: { 'process.env.NODE_ENV': '"production"' }, |
| 10 | build: { |
| 11 | outDir: '../viewer', |
| 12 | emptyOutDir: false, // index.html, NOTICE and the bridge.js link live there too |
| 13 | target: 'es2020', |
| 14 | lib: { entry: 'src/main.tsx', formats: ['iife'], name: 'doudizhu', fileName: () => 'app.js', cssFileName: 'app' }, |
| 15 | }, |
| 16 | }); |
