console/packages/web/app/vite.config.ts
Jonathan Brennan 44cc1d7db1
Upgrade web/app to tailwind v4 (#7490)
Co-authored-by: Dotan Simha <dotansimha@gmail.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Piotr Monwid-Olechnowicz <hasparus@gmail.com>
2026-01-21 05:11:25 -06:00

61 lines
1.6 KiB
TypeScript

import { resolve } from 'node:path';
import type { Plugin, UserConfig } from 'vite';
import monacoEditor from 'vite-plugin-monaco-editor';
import tsconfigPaths from 'vite-tsconfig-paths';
import tailwindcss from '@tailwindcss/vite';
import react from '@vitejs/plugin-react';
const __dirname = new URL('.', import.meta.url).pathname;
// Add react-scan in local development mode
const reactScanPlugin: Plugin = {
name: 'react-scan',
transformIndexHtml(html, ctx) {
if (ctx.server?.config.command === 'serve') {
return html.replace(
'<head>',
'<head><script src="https://unpkg.com/react-scan/dist/auto.global.js"></script>',
);
}
return html;
},
};
export default {
root: __dirname,
plugins: [
tsconfigPaths(),
react(),
tailwindcss(),
reactScanPlugin,
// @ts-expect-error temp
monacoEditor.default({
languageWorkers: ['json', 'typescript', 'editorWorkerService'],
customWorkers: [
{
label: 'graphql',
entry: 'monaco-graphql/dist/graphql.worker',
},
],
}),
],
build: {
rollupOptions: {
input: {
index: resolve(__dirname, 'index.html'),
['preflight-worker-embed']: resolve(__dirname, 'preflight-worker-embed.html'),
},
output: {
entryFileNames: '[name].js',
},
},
},
optimizeDeps: {
include: [
'monaco-editor/esm/vs/editor/editor.api',
'monaco-editor/esm/vs/language/json/monaco.contribution',
'monaco-graphql/esm/monaco.contribution',
],
},
} satisfies UserConfig;