Skip to content

Commit cb6b1ea

Browse files
author
Ante Borzić
committed
feat: add build.config.ts
1 parent fa8be72 commit cb6b1ea

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

build.config.ts

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import { defineBuildConfig } from 'unbuild';
2+
import { name, version } from './package.json';
3+
4+
// https://github.com/unjs/unbuild
5+
export default defineBuildConfig({
6+
declaration: true,
7+
failOnWarn: false,
8+
rollup: {
9+
esbuild: {
10+
minify: false,
11+
},
12+
},
13+
entries: [
14+
// mkdist builder transpiles file-to-file keeping original sources structure
15+
{
16+
builder: 'mkdist',
17+
input: './src/',
18+
outDir: './dist',
19+
format: 'esm',
20+
pattern: ['**', '!**/*.test.ts'],
21+
esbuild: {
22+
define: {
23+
PACKAGE_VERSION: `"${version}"`,
24+
PACKAGE_NAME: `"${name}"`,
25+
},
26+
},
27+
},
28+
{
29+
builder: 'mkdist',
30+
input: './src/',
31+
outDir: './dist',
32+
format: 'cjs',
33+
ext: 'cjs',
34+
// https://github.com/sindresorhus/globby
35+
pattern: ['**', '!**/*.test.ts'],
36+
// Declarations already created for esm build
37+
declaration: false,
38+
esbuild: {
39+
define: {
40+
PACKAGE_VERSION: `"${version}"`,
41+
PACKAGE_NAME: `"${name}"`,
42+
},
43+
},
44+
},
45+
],
46+
});

0 commit comments

Comments
 (0)