-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptions.ts
135 lines (134 loc) · 2.89 KB
/
options.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
import type { EntryOptions } from './entries'
import type { HooksOptions } from './hooks'
import type { Alias } from '@rollup/plugin-alias'
export interface Options {
/**
* Specifies the bundle's entry points.
*
* It allows you to manually set all build entries and adjust options for each one individually.
*
* @example
*
* ```ts
* export default defineConfig({
* entries: [
* { input: './src/index.ts' }, // => './dist/index.mjs'
* { dts: './src/types.ts' }, // => './dist/types.d.mts'
* // ...
* ]
* })
* ```
*/
entries: EntryOptions[]
/**
* Specifies the output directory for production bundle.
*
* @example
*
* ```ts
* export default defineConfig({
* outDir: 'output',
* })
* ```
*
* @default 'dist'
*/
outDir?: string
/**
* Specifies the module IDs, or regular expressions to match module IDs,
* that should remain external to the bundle.
*
* IDs and regexps from this option are applied globally to all entries.
*
* Also, it is possible to define externals individually per entry (`entry.externals`).
*
* @example
*
* ```ts
* export default defineConfig({
* externals: ['id-1', 'id-2', /regexp/],
* })
* ```
*
* @default [/^node:/, /^@types/, /^@rollup/, /^@hypernym/, /^rollup/, ...pkg.dependencies]
*/
externals?: (string | RegExp)[]
/**
* Provides a powerful hooking system to further expand bundling mode.
*
* @example
*
* ```ts
* export default defineConfig({
* hooks: {
* 'build:end': async (options, buildStats) => {
* // ...
* }
* }
* })
* ```
*
* @default undefined
*/
hooks?: HooksOptions
/**
* Specifies prefixes that will resolve imports with custom paths.
*
* Enables these `alias` by default:
*
* ```ts
* // Imports module from './src/utils/index.js'
* import { module } from '@/utils' // @
* import { module } from '~/utils' // ~
* ```
*
* Also, it is possible to completely override the default aliases by setting custom ones.
*
* @example
*
* ```ts
* export default defineConfig({
* alias: [
* { find: /^#/, replacement: resolve('./src') },
* ]
* })
* ```
*
* Now imports can be used like this:
*
* ```ts
* // Imports module from './src/utils/index.js'
* import { module } from '#/utils' // #
* ```
*
* @default undefined
*/
alias?: Alias[]
/**
* Specifies the minification for all `chunk` entries.
*
* @example
*
* ```ts
* export default defineConfig({
* minify: true,
* })
* ```
*
* It can also be set per entry.
*
* ```ts
* export default defineConfig({
* entries: [
* {
* input: './src/index.ts',
* minify: true,
* },
* ],
* })
* ```
*
* @default undefined
*/
minify?: boolean
}