33 lines
782 B
TypeScript
33 lines
782 B
TypeScript
|
|
import { resolve } from 'path'
|
||
|
|
import react from '@vitejs/plugin-react'
|
||
|
|
import { defineConfig } from 'vite'
|
||
|
|
import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js'
|
||
|
|
|
||
|
|
export default defineConfig(({ mode }) => ({
|
||
|
|
plugins: [react(), cssInjectedByJsPlugin()],
|
||
|
|
build: {
|
||
|
|
lib: {
|
||
|
|
entry: resolve(__dirname, 'src/index.tsx'),
|
||
|
|
name: 'GlitchComponent',
|
||
|
|
fileName: 'diophantine-sphere',
|
||
|
|
formats: ['iife']
|
||
|
|
},
|
||
|
|
rollupOptions: {
|
||
|
|
external: ['react', 'react-dom'],
|
||
|
|
output: {
|
||
|
|
globals: {
|
||
|
|
react: 'React',
|
||
|
|
'react-dom': 'ReactDOM'
|
||
|
|
},
|
||
|
|
assetFileNames: 'assets/[name][extname]'
|
||
|
|
}
|
||
|
|
},
|
||
|
|
sourcemap: true,
|
||
|
|
minify: mode === 'production'
|
||
|
|
},
|
||
|
|
server: {
|
||
|
|
port: 3002,
|
||
|
|
open: true
|
||
|
|
}
|
||
|
|
}))
|