mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
44 lines
1.3 KiB
TypeScript
44 lines
1.3 KiB
TypeScript
import { defineConfig, type PluginOption } from 'vite';
|
|
import react from '@vitejs/plugin-react-swc';
|
|
import viteTsconfigPaths from 'vite-tsconfig-paths';
|
|
import svgrPlugin from 'vite-plugin-svgr';
|
|
import { visualizer } from 'rollup-plugin-visualizer';
|
|
import ProgmemGenerator from './progmem-generator';
|
|
|
|
export default defineConfig(({ command, mode }) => {
|
|
if (mode === 'hosted') {
|
|
return {
|
|
// hosted, ignore all errors, output to dist
|
|
// plugins: [react({ plugins: [['@swc/plugin-styled-components', {}]] }), viteTsconfigPaths(), svgrPlugin()]
|
|
plugins: [react(), viteTsconfigPaths(), svgrPlugin(), visualizer({ gzipSize: true }) as PluginOption]
|
|
};
|
|
} else {
|
|
// normal build
|
|
return {
|
|
plugins: [
|
|
react(),
|
|
viteTsconfigPaths(),
|
|
svgrPlugin(),
|
|
ProgmemGenerator({ outputPath: '../lib/framework/WWWData.h', bytesPerLine: 20 })
|
|
],
|
|
build: {
|
|
outDir: 'build',
|
|
chunkSizeWarningLimit: 1024
|
|
},
|
|
server: {
|
|
open: true,
|
|
port: 3000,
|
|
proxy: {
|
|
'/rest': 'http://localhost:3080',
|
|
'/api': {
|
|
target: 'http://localhost:3080',
|
|
changeOrigin: true,
|
|
secure: false,
|
|
ws: true
|
|
}
|
|
}
|
|
}
|
|
};
|
|
}
|
|
});
|