build: setup library build mode and compile dist
This commit is contained in:
+23
-4
@@ -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'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user