mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 11:36:42 +00:00
9e5e96b9e4
* fix: client lib require wrapper * fix: bug * fix: add tsconfig.paths.json * fix: collection dir not exists * fix: improve... * fix: update yarn.lock * fix: db.sync * fix: bugs * fix: bugs * fix: bugs * fix: bugs && allow user custom build config * docs: user custom config docs * refactor: custom user build config * fix: bugs * fix: build plugin-client bug --------- Co-authored-by: chenos <chenlinxh@gmail.com>
47 lines
1.2 KiB
TypeScript
47 lines
1.2 KiB
TypeScript
import react from '@vitejs/plugin-react';
|
|
import { defineConfig } from 'vitest/config';
|
|
import tsConfigPaths from './tsconfig.paths.json';
|
|
|
|
const paths = tsConfigPaths.compilerOptions.paths;
|
|
|
|
const alias = Object.keys(paths).reduce<{ find: string; replacement: string }[]>((acc, key) => {
|
|
if (key !== '@@/*') {
|
|
const value = paths[key][0];
|
|
acc.push({
|
|
find: key,
|
|
replacement: value,
|
|
});
|
|
}
|
|
return acc;
|
|
}, []);
|
|
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
resolve: {
|
|
mainFields: ['module'],
|
|
},
|
|
test: {
|
|
globals: true,
|
|
setupFiles: 'scripts/setupVitest.ts',
|
|
environment: 'jsdom',
|
|
css: false,
|
|
threads: true,
|
|
alias: [
|
|
{ find: 'testUtils', replacement: 'testUtils.ts' },
|
|
{ find: /^~antd\/(.*)/, replacement: 'antd/$1' },
|
|
...alias,
|
|
],
|
|
include: ['packages/**/{dumi-theme-nocobase,sdk,client}/**/__tests__/**/*.{test,spec}.{ts,tsx}'],
|
|
exclude: ['**/node_modules/**', '**/dist/**', '**/lib/**', '**/es/**', '**/{vitest,commitlint}.config.*'],
|
|
testTimeout: 300000,
|
|
bail: 1,
|
|
// 在 GitHub Actions 中不输出日志
|
|
silent: !!process.env.GITHUB_ACTIONS,
|
|
server: {
|
|
deps: {
|
|
inline: ['@juggle/resize-observer', 'clsx'],
|
|
},
|
|
},
|
|
},
|
|
});
|