Files
twenty/packages/twenty-shared/vite.config.individual.ts
T
martmullandGitHub e3fcff00b0 Fix initial code step functionInput (#18002)
At code step creation

## before
<img width="623" height="816" alt="image"
src="https://github.com/user-attachments/assets/0aed5ed8-8d56-4988-9d31-fe80942191bb"
/>

## after
<img width="627" height="528" alt="image"
src="https://github.com/user-attachments/assets/9e2a5cb9-7480-4734-8e41-25b45edcec07"
/>
2026-02-17 16:45:00 +01:00

65 lines
1.5 KiB
TypeScript

import path from 'path';
import { type UserConfig, defineConfig } from 'vite';
import tsconfigPaths from 'vite-tsconfig-paths';
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: {
alias: {
'@/': path.resolve(__dirname, 'src') + '/',
},
},
plugins: [
tsconfigPaths({
root: __dirname,
}),
],
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',
};
});