Skip to content

Commit

Permalink
feat: add build.config.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
b0rza committed Jun 28, 2024
1 parent a7f45b4 commit 0ea0af6
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions build.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { defineBuildConfig } from 'unbuild';
import { name, version } from './package.json';

// https://github.com/unjs/unbuild
export default defineBuildConfig({
declaration: true,
failOnWarn: false,
rollup: {
esbuild: {
minify: false,
},
},
entries: [
// mkdist builder transpiles file-to-file keeping original sources structure
{
builder: 'mkdist',
input: './src/',
outDir: './dist',
format: 'esm',
pattern: ['**', '!**/*.test.ts'],
esbuild: {
define: {
PACKAGE_VERSION: `"${version}"`,
PACKAGE_NAME: `"${name}"`,
},
},
},
{
builder: 'mkdist',
input: './src/',
outDir: './dist',
format: 'cjs',
ext: 'cjs',
// https://github.com/sindresorhus/globby
pattern: ['**', '!**/*.test.ts'],
// Declarations already created for esm build
declaration: false,
esbuild: {
define: {
PACKAGE_VERSION: `"${version}"`,
PACKAGE_NAME: `"${name}"`,
},
},
},
],
});

0 comments on commit 0ea0af6

Please sign in to comment.