build: 2 setup library build mode and compile dist

This commit is contained in:
Firman Syah 2026-05-18 16:56:09 +07:00
parent 735217efc5
commit 24e85d898f

View File

@ -6,16 +6,16 @@ export default defineConfig({
plugins: [react()], plugins: [react()],
build: { build: {
lib: { lib: {
// Point this to the file where your BaseButton component lives
entry: resolve(__dirname, 'src/App.jsx'), entry: resolve(__dirname, 'src/App.jsx'),
name: 'OslogReactBaseComponent', name: 'OslogReactBaseComponent',
fileName: 'index', fileName: 'index',
formats: ['es'] // Outputs an ES Module (index.js) formats: ['es']
}, },
rollupOptions: { rollupOptions: {
// Don't bundle react or react-dom into your library
external: ['react', 'react-dom'], external: ['react', 'react-dom'],
output: { output: {
// Force explicit named exports matching your source code
exports: 'named',
globals: { globals: {
react: 'React', react: 'React',
'react-dom': 'ReactDOM' 'react-dom': 'ReactDOM'