mirror of
https://github.com/vitejs/vite.git
synced 2024-11-22 07:09:05 +00:00
36 lines
881 B
TypeScript
36 lines
881 B
TypeScript
import path from 'node:path'
|
|
import url from 'node:url'
|
|
import { defineBuildConfig } from 'unbuild'
|
|
import licensePlugin from '../vite/rollupLicensePlugin'
|
|
|
|
const __dirname = path.dirname(url.fileURLToPath(import.meta.url))
|
|
|
|
export default defineBuildConfig({
|
|
entries: ['src/index'],
|
|
clean: true,
|
|
rollup: {
|
|
inlineDependencies: true,
|
|
esbuild: {
|
|
target: 'node18',
|
|
minify: true,
|
|
},
|
|
},
|
|
alias: {
|
|
// we can always use non-transpiled code since we support node 18+
|
|
prompts: 'prompts/lib/index.js',
|
|
},
|
|
hooks: {
|
|
'rollup:options'(ctx, options) {
|
|
options.plugins = [
|
|
options.plugins,
|
|
// @ts-expect-error TODO: unbuild uses rollup v3 and Vite uses rollup v4
|
|
licensePlugin(
|
|
path.resolve(__dirname, './LICENSE'),
|
|
'create-vite license',
|
|
'create-vite',
|
|
),
|
|
]
|
|
},
|
|
},
|
|
})
|