47 lines
1.0 KiB
JavaScript
47 lines
1.0 KiB
JavaScript
// @ts-check
|
|
import chalk from 'chalk'
|
|
import { dirname, resolve } from 'path'
|
|
import dts from 'unplugin-dts/vite'
|
|
import { fileURLToPath } from 'url'
|
|
import { defineConfig } from 'vite'
|
|
import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js'
|
|
|
|
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
|
|
console.log(chalk.cyan(`📦 Building @page-agent/ui`))
|
|
|
|
export default defineConfig({
|
|
clearScreen: false,
|
|
plugins: [
|
|
dts({
|
|
bundleTypes: true,
|
|
compilerOptions: {
|
|
composite: true,
|
|
noEmit: false,
|
|
emitDeclarationOnly: true,
|
|
declaration: true,
|
|
},
|
|
}),
|
|
cssInjectedByJsPlugin({ relativeCSSInjection: true }),
|
|
],
|
|
publicDir: false,
|
|
build: {
|
|
lib: {
|
|
entry: resolve(__dirname, 'src/index.ts'),
|
|
name: 'PageAgentUI',
|
|
fileName: 'page-agent-ui',
|
|
formats: ['es'],
|
|
},
|
|
outDir: resolve(__dirname, 'dist', 'lib'),
|
|
rollupOptions: {
|
|
external: [],
|
|
},
|
|
minify: false,
|
|
sourcemap: true,
|
|
cssCodeSplit: true,
|
|
},
|
|
define: {
|
|
'process.env.NODE_ENV': '"production"',
|
|
},
|
|
})
|