-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.config.ts
More file actions
45 lines (42 loc) · 1.3 KB
/
build.config.ts
File metadata and controls
45 lines (42 loc) · 1.3 KB
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
/* eslint-disable @typescript-eslint/naming-convention */
import { defineBuildConfig } from 'unbuild'
export default defineBuildConfig([
// Node build
{
name: 'node',
entries: [{ input: './src/index', name: 'index' }],
declaration: true,
rollup: { emitCJS: true, output: { exports: 'named' }, esbuild: { treeShaking: true, charset: 'ascii' }, preserveDynamicImports: true },
outDir: './build/node',
failOnWarn: false,
},
// Browser build
{
name: 'browser',
entries: [{ input: './src/index.browser', name: 'index' }],
declaration: true,
rollup: { emitCJS: false, output: { exports: 'named' }, esbuild: { treeShaking: true, charset: 'ascii' }, preserveDynamicImports: true },
hooks: {
'rollup:options'(_ctx, options) {
options.external = () => false
},
},
outDir: './build/browser',
failOnWarn: false,
},
// Tests build (auto-discovers files)
{
name: 'tests',
// Treat the directory as a multi-entry source
entries: [{ input: './src', builder: 'mkdist', ext: 'js' }],
outDir: './test-build',
declaration: false,
rollup: {
emitCJS: false,
esbuild: { treeShaking: true, charset: 'ascii' },
preserveDynamicImports: true,
output: { exports: 'named' },
},
failOnWarn: false,
},
])