Files
twenty/packages/twenty-ui/vite.config.individual.ts
T
Parship Chowdhury 6ee5413951 chore(vite): replace vite-tsconfig-paths with resolve.tsconfigPaths (#22100)
### Summary
Migrates main monorepo packages from the `vite-tsconfig-paths` plugin to
vite’s built-in path resolution.

Vite 8 showing this warning when the plugin is detected:
> The plugin "vite-tsconfig-paths" is detected. Vite now supports
tsconfig paths resolution natively via the resolve.tsconfigPaths option.
You can remove the plugin and set resolve.tsconfigPaths: true in your
Vite config instead.

### References
- https://vite.dev/config/shared-options#resolve-tsconfigpaths
- https://vite.dev/guide/features#paths
- https://github.com/vitejs/vite/pull/21781

<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/twentyhq/twenty/pull/22100?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->

---------

Signed-off-by: Parship Chowdhury <parshipchowdhury@gmail.com>
2026-06-24 19:03:18 +02:00

75 lines
2.0 KiB
TypeScript

import react from '@vitejs/plugin-react-swc';
import * as path from 'path';
import { defineConfig } from 'vite';
import svgr from 'vite-plugin-svgr';
import packageJson from './package.json';
const depNames = Object.keys({
...(packageJson.dependencies || {}),
...(packageJson.peerDependencies || {}),
});
const isExternal = (id: string): boolean =>
depNames.some((dep) => id === dep || id.startsWith(dep + '/'));
export default defineConfig(() => {
return {
resolve: {
tsconfigPaths: true,
alias: {
'@ui/': path.resolve(__dirname, 'src') + '/',
'@assets/': path.resolve(__dirname, 'src/assets') + '/',
'@styles/': path.resolve(__dirname, 'src/styles') + '/',
},
},
css: {
modules: {
localsConvention: 'camelCaseOnly',
},
preprocessorOptions: {
scss: {
api: 'modern-compiler',
loadPaths: [path.resolve(__dirname, 'src/styles')],
additionalData: [
`@use 'abstracts/functions' as *;`,
`@use 'abstracts/mixins' as *;`,
`@use 'abstracts/breakpoints' as *;`,
'',
].join('\n'),
},
},
},
root: __dirname,
cacheDir: '../../node_modules/.vite/packages/twenty-ui-individual',
assetsInclude: ['src/**/*.svg'],
plugins: [react(), svgr()],
build: {
cssCodeSplit: false,
minify: 'esbuild',
sourcemap: true,
outDir: './dist/individual',
emptyOutDir: true,
commonjsOptions: {
transformMixedEsModules: true,
interopDefault: true,
defaultIsModuleExports: true,
requireReturnsDefault: 'auto',
},
lib: {
entry: 'src/individual-entry.ts',
formats: ['es'],
},
rollupOptions: {
external: isExternal,
output: {
preserveModules: true,
preserveModulesRoot: 'src',
entryFileNames: '[name].js',
},
},
},
logLevel: 'warn',
};
});