Skip to content

Commit

Permalink
Create vite.config.js
Browse files Browse the repository at this point in the history
changing the build package
  • Loading branch information
HarshMN2345 authored Oct 19, 2024
1 parent d887729 commit d7640c5
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions lib/vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import path from 'path';

export default defineConfig(({ mode }) => {
const isProduction = mode === 'production';

return {
plugins: [react()],
build: {
sourcemap: isProduction ? false : 'eval-cheap-module-source-map',
lib: {
entry: path.resolve(__dirname, 'src/index.ts'),
name: 'AsgardeoAuth',
fileName: 'main',
formats: ['umd']
},
rollupOptions: {
external: ['react', 'react-dom', 'react-router-dom'],
output: {
globals: {
react: 'React',
'react-dom': 'ReactDOM',
'react-router-dom': 'ReactRouter'
}
}
}
},
resolve: {
alias: {
'@': path.resolve(__dirname, './src')
},
extensions: ['.tsx', '.ts', '.jsx', '.js']
},
esbuild: {
jsxInject: `import React from 'react'` // Optional: If you use JSX without importing React
},
server: {
strictPort: true,
port: 3000
}
};
});

0 comments on commit d7640c5

Please sign in to comment.