8190cd5fbf
https://github.com/user-attachments/assets/ce1b2b06-872f-41d0-844a-61db91696624 --------- Co-authored-by: Charles Bochet <charles@twenty.com>
54 lines
1.1 KiB
TypeScript
54 lines
1.1 KiB
TypeScript
import * as path from 'path';
|
|
import { type UserConfig, defineConfig } from 'vite';
|
|
import tsconfigPaths from 'vite-tsconfig-paths';
|
|
|
|
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-sdk-sdk',
|
|
resolve: {
|
|
alias: {
|
|
'@/': path.resolve(__dirname, 'src') + '/',
|
|
},
|
|
},
|
|
plugins: [
|
|
tsconfigPaths({
|
|
root: __dirname,
|
|
}),
|
|
],
|
|
build: {
|
|
minify: 'esbuild',
|
|
sourcemap: true,
|
|
outDir: './dist/sdk',
|
|
emptyOutDir: false,
|
|
lib: {
|
|
entry: {
|
|
index: 'src/sdk/index.ts',
|
|
},
|
|
formats: ['es'],
|
|
},
|
|
rollupOptions: {
|
|
external: isExternal,
|
|
output: {
|
|
preserveModules: true,
|
|
preserveModulesRoot: 'src/sdk',
|
|
entryFileNames: '[name].js',
|
|
},
|
|
},
|
|
},
|
|
logLevel: 'warn',
|
|
};
|
|
});
|