Files
twenty/packages/twenty-emails/vite.config.ts
T
216a7331f8 Speed up twenty-emails build by replacing vite-plugin-dts with tsgo (#17857)
## Summary

- Removed `vite-plugin-dts` (which used `tsc` internally) from the Vite
build and replaced DTS generation with `tsgo` as a sequential post-build
step — **~0.7s vs 1-10s**.
- Disabled `reportCompressedSize` to skip gzip computation for 64 output
files.
- Converted the build target to an explicit `nx:run-commands` executor
with sequential `vite build` → `tsgo` commands.

The `twenty-emails:build` step goes from ~22s to ~7s under load. 

## Test plan

- [x] `nx build twenty-emails` produces both JS (64 files) and DTS (74
files) correctly
- [x] `dist/index.d.ts` exports match the source `src/index.ts`
- [x] Full `nx build twenty-server` succeeds end-to-end
- [ ] CI build passes


Made with [Cursor](https://cursor.com)

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-13 10:39:26 +00:00

56 lines
1.3 KiB
TypeScript

import { lingui } from '@lingui/vite-plugin';
import react from '@vitejs/plugin-react-swc';
import * as path from 'path';
import { APP_LOCALES } from 'twenty-shared/translations';
import { defineConfig } from 'vite';
import tsconfigPaths from 'vite-tsconfig-paths';
export default defineConfig({
root: __dirname,
cacheDir: '../../node_modules/.vite/packages/twenty-emails',
resolve: {
alias: {
'@/': path.resolve(__dirname, 'src') + '/',
'src/': path.resolve(__dirname, 'src') + '/',
},
},
plugins: [
react({
plugins: [['@lingui/swc-plugin', {}]],
}),
lingui({
configPath: path.resolve(__dirname, './lingui.config.ts'),
}),
tsconfigPaths({
root: __dirname,
}),
],
build: {
outDir: './dist',
reportCompressedSize: false,
commonjsOptions: {
transformMixedEsModules: true,
},
lib: {
entry: {
index: 'src/index.ts',
...Object.values(APP_LOCALES).reduce(
(acc, locale) => ({
...acc,
[`locales/generated/${locale}`]: `src/locales/generated/${locale}.ts`,
}),
{},
),
},
name: 'twenty-emails',
formats: ['es', 'cjs'],
},
rollupOptions: {
external: ['react', 'react-dom', 'react/jsx-runtime'],
},
},
});