forked from vitejs/vite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.config.ts
35 lines (33 loc) · 881 Bytes
/
build.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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',
),
]
},
},
})