6ee5413951
### 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>
60 lines
1.4 KiB
TypeScript
60 lines
1.4 KiB
TypeScript
import path from 'path';
|
|
import { type UserConfig, defineConfig } from 'vite';
|
|
import packageJson from './package.json';
|
|
|
|
const submodules = Object.keys((packageJson as any).exports || {})
|
|
.filter((key) => key !== '.' && !key.startsWith('./src/'))
|
|
.map((key) => key.replace(/^\.\//, ''));
|
|
|
|
const entries: Record<string, string> = {
|
|
'individual-entry': 'src/individual-entry.ts',
|
|
};
|
|
|
|
for (const submodule of submodules) {
|
|
entries[`${submodule}/index`] = `src/${submodule}/index.ts`;
|
|
}
|
|
|
|
const isExternal = (id: string): boolean => {
|
|
if (id.startsWith('.') || id.startsWith('/') || id.startsWith('\0')) {
|
|
return false;
|
|
}
|
|
|
|
if (id.startsWith('src/') || id.startsWith('@/')) {
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
};
|
|
|
|
export default defineConfig((): UserConfig => {
|
|
return {
|
|
root: __dirname,
|
|
cacheDir: '../../node_modules/.vite/packages/twenty-shared-individual',
|
|
resolve: {
|
|
tsconfigPaths: true,
|
|
alias: {
|
|
'@/': path.resolve(__dirname, 'src') + '/',
|
|
},
|
|
},
|
|
build: {
|
|
minify: 'esbuild',
|
|
sourcemap: true,
|
|
outDir: './dist/individual',
|
|
emptyOutDir: true,
|
|
lib: {
|
|
entry: entries,
|
|
formats: ['es'],
|
|
},
|
|
rollupOptions: {
|
|
external: isExternal,
|
|
output: {
|
|
preserveModules: true,
|
|
preserveModulesRoot: 'src',
|
|
entryFileNames: '[name].js',
|
|
},
|
|
},
|
|
},
|
|
logLevel: 'warn',
|
|
};
|
|
});
|