Fix vite build config (#3358)
* Fix vite build config * Fix vite build config * Fix vite build config * Fix * Fix * Fix * Fix * Fix * Fix
This commit is contained in:
@ -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',
|
||||
|
||||
@ -23,7 +23,7 @@ export const RecordTableColumnDropdownMenu = ({
|
||||
const { handleColumnVisibilityChange, handleMoveTableColumn } =
|
||||
useTableColumns();
|
||||
|
||||
const { closeDropdown } = useDropdown();
|
||||
const { closeDropdown } = useDropdown(column.fieldMetadataId + '-header');
|
||||
|
||||
const handleColumnMoveLeft = () => {
|
||||
closeDropdown();
|
||||
|
||||
@ -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,
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user