Skip to content

The open alternative to Salesforce, designed for AI.

Fix vite build config (#3358)

Charles Bochet49f66fec70cd
diff --git a/packages/twenty-front/.eslintrc.cjs b/packages/twenty-front/.eslintrc.cjs
index 906d1c56d88..f62981fbc8e 100644
--- a/packages/twenty-front/.eslintrc.cjs
+++ b/packages/twenty-front/.eslintrc.cjs
@@ -1,4 +1,4 @@
-// eslint-disable-next-line @typescript-eslint/no-var-requires
+// eslint-disable-next-line
const path = require('path');
module.exports = {
@@ -15,7 +15,10 @@ module.exports = {
'node_modules',
'mockServiceWorker.js',
'**/generated*/*',
- '*config.*',
+ 'tsup.config.ts',
+ 'build',
+ 'coverage',
+ 'storybook-static',
'**/*config.js',
'codegen*',
'tsup.ui.index.tsx',
diff --git a/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableColumnDropdownMenu.tsx b/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableColumnDropdownMenu.tsx
index 1b08faf2044..0b0fa1bc46c 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableColumnDropdownMenu.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableColumnDropdownMenu.tsx
@@ -23,7 +23,7 @@ export const RecordTableColumnDropdownMenu = ({
const { handleColumnVisibilityChange, handleMoveTableColumn } =
useTableColumns();
- const { closeDropdown } = useDropdown();
+ const { closeDropdown } = useDropdown(column.fieldMetadataId + '-header');
const handleColumnMoveLeft = () => {
closeDropdown();
diff --git a/packages/twenty-front/vite.config.ts b/packages/twenty-front/vite.config.ts
index 68b21397e2f..a63e5b709d1 100644
--- a/packages/twenty-front/vite.config.ts
+++ b/packages/twenty-front/vite.config.ts
@@ -1,49 +1,57 @@
-import { defineConfig, loadEnv } from 'vite';
import react from '@vitejs/plugin-react-swc';
-import tsconfigPaths from 'vite-tsconfig-paths';
+import { defineConfig, loadEnv } from 'vite';
+import checker from 'vite-plugin-checker';
import svgr from 'vite-plugin-svgr';
-import checker from 'vite-plugin-checker'
+import tsconfigPaths from 'vite-tsconfig-paths';
+
+type Checkers = Parameters<typeof checker>[0];
// https://vitejs.dev/config/
-export default defineConfig(({ mode }) => {
- const env = loadEnv(mode, process.cwd(), '')
+export default defineConfig(({ command, mode }) => {
+ const env = loadEnv(mode, process.cwd(), '');
/*
Using explicit env variables, there is no need to expose all of them (security).
*/
- const {
- REACT_APP_SERVER_BASE_URL,
- } = env;
+ const { REACT_APP_SERVER_BASE_URL } = env;
+
+ const isBuildCommand = command === 'build';
+
+ const checkers: Checkers = {
+ typescript: {
+ tsconfigPath: 'tsconfig.app.json',
+ },
+ };
+
+ if (!isBuildCommand) {
+ checkers['eslint'] = {
+ lintCommand:
+ 'eslint . --report-unused-disable-directives --max-warnings 0 --config .eslintrc.cjs',
+ };
+ }
const plugins = [
- react({ jsxImportSource: "@emotion/react" }),
+ react({ jsxImportSource: '@emotion/react' }),
tsconfigPaths(),
svgr(),
- checker({
- typescript: {
- tsconfigPath: "tsconfig.app.json"
- },
- eslint: {
- lintCommand: "eslint . --report-unused-disable-directives --max-warnings 0 --config .eslintrc.cjs",
- }
- }),
- ]
+ checker(checkers),
+ ];
return {
// base: ,
envPrefix: 'REACT_APP_',
build: {
outDir: 'build',
- },
+ },
plugins,
server: {
// open: true,
port: 3001,
},
define: {
- "process.env": {
+ 'process.env': {
REACT_APP_SERVER_BASE_URL,
- }
- },
- }
+ },
+ },
+ };
});