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');
|
const path = require('path');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@ -15,7 +15,10 @@ module.exports = {
|
|||||||
'node_modules',
|
'node_modules',
|
||||||
'mockServiceWorker.js',
|
'mockServiceWorker.js',
|
||||||
'**/generated*/*',
|
'**/generated*/*',
|
||||||
'*config.*',
|
'tsup.config.ts',
|
||||||
|
'build',
|
||||||
|
'coverage',
|
||||||
|
'storybook-static',
|
||||||
'**/*config.js',
|
'**/*config.js',
|
||||||
'codegen*',
|
'codegen*',
|
||||||
'tsup.ui.index.tsx',
|
'tsup.ui.index.tsx',
|
||||||
|
|||||||
@ -23,7 +23,7 @@ export const RecordTableColumnDropdownMenu = ({
|
|||||||
const { handleColumnVisibilityChange, handleMoveTableColumn } =
|
const { handleColumnVisibilityChange, handleMoveTableColumn } =
|
||||||
useTableColumns();
|
useTableColumns();
|
||||||
|
|
||||||
const { closeDropdown } = useDropdown();
|
const { closeDropdown } = useDropdown(column.fieldMetadataId + '-header');
|
||||||
|
|
||||||
const handleColumnMoveLeft = () => {
|
const handleColumnMoveLeft = () => {
|
||||||
closeDropdown();
|
closeDropdown();
|
||||||
|
|||||||
@ -1,33 +1,41 @@
|
|||||||
import { defineConfig, loadEnv } from 'vite';
|
|
||||||
import react from '@vitejs/plugin-react-swc';
|
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 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/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig(({ mode }) => {
|
export default defineConfig(({ command, mode }) => {
|
||||||
const env = loadEnv(mode, process.cwd(), '')
|
const env = loadEnv(mode, process.cwd(), '');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Using explicit env variables, there is no need to expose all of them (security).
|
Using explicit env variables, there is no need to expose all of them (security).
|
||||||
*/
|
*/
|
||||||
const {
|
const { REACT_APP_SERVER_BASE_URL } = env;
|
||||||
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 = [
|
const plugins = [
|
||||||
react({ jsxImportSource: "@emotion/react" }),
|
react({ jsxImportSource: '@emotion/react' }),
|
||||||
tsconfigPaths(),
|
tsconfigPaths(),
|
||||||
svgr(),
|
svgr(),
|
||||||
checker({
|
checker(checkers),
|
||||||
typescript: {
|
];
|
||||||
tsconfigPath: "tsconfig.app.json"
|
|
||||||
},
|
|
||||||
eslint: {
|
|
||||||
lintCommand: "eslint . --report-unused-disable-directives --max-warnings 0 --config .eslintrc.cjs",
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
]
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
// base: ,
|
// base: ,
|
||||||
@ -41,9 +49,9 @@ export default defineConfig(({ mode }) => {
|
|||||||
port: 3001,
|
port: 3001,
|
||||||
},
|
},
|
||||||
define: {
|
define: {
|
||||||
"process.env": {
|
'process.env': {
|
||||||
REACT_APP_SERVER_BASE_URL,
|
REACT_APP_SERVER_BASE_URL,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
}
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user