This repository has been archived by the owner on Feb 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.config.ts
66 lines (64 loc) · 1.54 KB
/
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
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
import { defineBuildConfig } from 'unbuild'
/*
exports
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
},
"./webpack": {
"types": "./dist/platform-bindings/webpack.d.ts",
"import": "./dist/platform-bindings/webpack.mjs",
"require": "./dist/platform-bindings/webpack.cjs"
},
"./vite": {
"types": "./dist/platform-bindings/vite.d.ts",
"import": "./dist/platform-bindings/vite.mjs",
"require": "./dist/platform-bindings/vite.cjs"
},
"./rollup": {
"types": "./dist/platform-bindings/rollup.d.ts",
"import": "./dist/platform-bindings/rollup.mjs",
"require": "./dist/platform-bindings/rollup.cjs"
}
*/
export default defineBuildConfig({
entries: [
{
builder: 'rollup',
input: './src/index',
name: 'index',
outDir: './dist',
declaration: true,
},
{
builder: 'rollup',
input: './src/platform-bindings/webpack',
name: 'webpack',
outDir: './dist',
declaration: true,
},
{
builder: 'rollup',
input: './src/platform-bindings/vite',
name: 'vite',
outDir: './dist',
declaration: true,
},
{
builder: 'rollup',
input: './src/platform-bindings/rollup',
name: 'rollup',
outDir: './dist',
declaration: true,
},
],
hooks: {
'build:before'(ctx) {
ctx.options.declaration = ctx.options.entries.some((_) => _.declaration)
},
},
rollup: {
emitCJS: true,
},
})