build: setup library build mode and compile dist

This commit is contained in:
2026-05-18 16:27:03 +07:00
parent 6851b8b8c7
commit 735217efc5
6 changed files with 797 additions and 15 deletions
+23 -4
View File
@@ -1,7 +1,26 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { resolve } from 'path';
// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
})
build: {
lib: {
// Point this to the file where your BaseButton component lives
entry: resolve(__dirname, 'src/App.jsx'),
name: 'OslogReactBaseComponent',
fileName: 'index',
formats: ['es'] // Outputs an ES Module (index.js)
},
rollupOptions: {
// Don't bundle react or react-dom into your library
external: ['react', 'react-dom'],
output: {
globals: {
react: 'React',
'react-dom': 'ReactDOM'
}
}
}
}
});