Setup library for publishing to npm

This commit is contained in:
2025-03-31 20:56:14 +01:00
parent eaa19a5c38
commit f9aadb20d3
52 changed files with 702 additions and 229 deletions
+19 -3
View File
@@ -1,13 +1,29 @@
import { defineConfig } from "vite";
import path from 'node:path';
import dts from "vite-plugin-dts";
import react from "@vitejs/plugin-react";
import svgr from "vite-plugin-svgr";
import { peerDependencies } from "./package.json";
export default defineConfig({
plugins: [react(), svgr()],
resolve: {
plugins: [react(), svgr(), dts({ insertTypesEntry: true, exclude: ["**/*.stories.ts", "**/*.test.tsx"] })],
resolve: {
alias: {
src: '/src',
src: path.resolve(__dirname, './src'),
},
},
build: {
lib: {
entry: path.resolve(__dirname, 'src/index.ts'),
name: 'ugly-ui',
fileName: (format) => `ugly-ui.${format}.js`,
formats: ['es', 'cjs', 'umd'],
},
rollupOptions: {
external: Object.keys(peerDependencies),
output: { globals: { react: 'React', 'react-dom': 'ReactDOM', 'styled-components': 'styled-components' } },
}
},
})