mirror of
https://github.com/penpot/penpot.git
synced 2026-02-12 22:53:02 +00:00
67 lines
1.5 KiB
TypeScript
67 lines
1.5 KiB
TypeScript
/// <reference types='vitest' />
|
|
import { defineConfig } from 'vite';
|
|
import react from '@vitejs/plugin-react';
|
|
import dts from 'vite-plugin-dts';
|
|
import * as path from 'path';
|
|
import { copyFileSync } from 'node:fs';
|
|
|
|
const copyCssPlugin = () => ({
|
|
name: 'copy-css',
|
|
closeBundle: () => {
|
|
try {
|
|
copyFileSync(
|
|
'dist/index.css',
|
|
'../../resources/public/css/ui.css',
|
|
);
|
|
} catch (e) {
|
|
console.log('Error copying css file', e);
|
|
}
|
|
},
|
|
});
|
|
|
|
export default defineConfig(() => ({
|
|
root: import.meta.dirname,
|
|
plugins: [
|
|
react({
|
|
babel: {
|
|
plugins: ['babel-plugin-react-compiler'],
|
|
},
|
|
}),
|
|
dts({
|
|
entryRoot: 'src',
|
|
tsconfigPath: path.join(import.meta.dirname, 'tsconfig.lib.json'),
|
|
pathsToAliases: false,
|
|
}),
|
|
copyCssPlugin(),
|
|
],
|
|
build: {
|
|
outDir: 'dist/',
|
|
emptyOutDir: true,
|
|
reportCompressedSize: true,
|
|
commonjsOptions: {
|
|
transformMixedEsModules: true,
|
|
},
|
|
lib: {
|
|
entry: 'src/index.ts',
|
|
name: 'ui',
|
|
fileName: 'index',
|
|
formats: ['es' as const],
|
|
},
|
|
rollupOptions: {
|
|
external: ['react', 'react-dom', 'react/jsx-runtime'],
|
|
},
|
|
},
|
|
test: {
|
|
name: 'ui',
|
|
watch: false,
|
|
globals: true,
|
|
environment: 'jsdom',
|
|
include: ['{src,tests}/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
|
reporters: ['default'],
|
|
coverage: {
|
|
reportsDirectory: '../../coverage/libs/ui',
|
|
provider: 'v8' as const,
|
|
},
|
|
},
|
|
}));
|