mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 23:00:34 +00:00
feat: initialize email-components vite package
This commit is contained in:
55
shared/email-components/vite.config.ts
Normal file
55
shared/email-components/vite.config.ts
Normal file
@@ -0,0 +1,55 @@
|
||||
import react from '@vitejs/plugin-react';
|
||||
import path from 'node:path';
|
||||
import { defineConfig } from 'vitest/config';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import tailwindcss from 'tailwindcss';
|
||||
import { UserConfigExport } from 'vite';
|
||||
import { name } from './package.json';
|
||||
|
||||
const app = async (): Promise<UserConfigExport> => {
|
||||
/**
|
||||
* Removes everything before the last
|
||||
* @octocat/library-repo -> library-repo
|
||||
* vite-component-library-template -> vite-component-library-template
|
||||
*/
|
||||
const formattedName = name.match(/[^/]+$/)?.[0] ?? name;
|
||||
|
||||
return defineConfig({
|
||||
plugins: [
|
||||
react(),
|
||||
dts({
|
||||
insertTypesEntry: true,
|
||||
}),
|
||||
],
|
||||
css: {
|
||||
postcss: {
|
||||
plugins: [tailwindcss],
|
||||
},
|
||||
},
|
||||
build: {
|
||||
lib: {
|
||||
entry: path.resolve(__dirname, 'src/lib/main.ts'),
|
||||
name: formattedName,
|
||||
formats: ['es', 'umd'],
|
||||
fileName: (format: string) => `${formattedName}.${format}.js`,
|
||||
},
|
||||
rollupOptions: {
|
||||
external: ['react', 'react/jsx-runtime', 'react-dom', 'tailwindcss'],
|
||||
output: {
|
||||
globals: {
|
||||
react: 'React',
|
||||
'react/jsx-runtime': 'react/jsx-runtime',
|
||||
'react-dom': 'ReactDOM',
|
||||
tailwindcss: 'tailwindcss',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
test: {
|
||||
globals: true,
|
||||
environment: 'jsdom',
|
||||
},
|
||||
});
|
||||
};
|
||||
// https://vitejs.dev/config/
|
||||
export default app;
|
||||
Reference in New Issue
Block a user