58 lines
1.2 KiB
TypeScript
58 lines
1.2 KiB
TypeScript
import { defineConfig } from 'vite';
|
|
import react from '@vitejs/plugin-react';
|
|
import dts from 'vite-plugin-dts';
|
|
import path from 'path';
|
|
|
|
export default defineConfig({
|
|
define: {
|
|
'process.env.NODE_ENV': JSON.stringify('production'),
|
|
},
|
|
|
|
plugins: [
|
|
react(),
|
|
dts({
|
|
insertTypesEntry: true,
|
|
include: ['src/**/*.ts', 'src/**/*.tsx'],
|
|
exclude: ['src/**/*.test.ts', 'src/**/*.test.tsx', 'node_modules'],
|
|
}),
|
|
],
|
|
|
|
build: {
|
|
lib: {
|
|
entry: path.resolve(__dirname, 'src/index.ts'),
|
|
name: 'Gnuboard7HelloAdminTemplate',
|
|
fileName: 'components',
|
|
formats: ['iife'],
|
|
},
|
|
|
|
outDir: 'dist',
|
|
emptyOutDir: true,
|
|
sourcemap: true,
|
|
|
|
rollupOptions: {
|
|
external: ['react', 'react-dom', 'react/jsx-runtime'],
|
|
|
|
output: {
|
|
globals: {
|
|
react: 'React',
|
|
'react-dom': 'ReactDOM',
|
|
'react/jsx-runtime': 'ReactJSXRuntime',
|
|
},
|
|
|
|
entryFileNames: 'js/components.iife.js',
|
|
chunkFileNames: 'js/[name]-[hash].js',
|
|
assetFileNames: 'assets/[name][extname]',
|
|
},
|
|
},
|
|
|
|
minify: 'esbuild',
|
|
target: 'es2020',
|
|
},
|
|
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, 'src'),
|
|
},
|
|
},
|
|
});
|