Skip to content

Commit

Permalink
fix: change build cjs and mjs to unbuild (#1163)
Browse files Browse the repository at this point in the history
* feat: install unbuild

* chore: update tsup config

* chore: update eslint config

* feat: add build.config.ts

* fix: new lock

---------

Co-authored-by: Toni Tabak <[email protected]>
  • Loading branch information
b0rza and tabaktoni committed Jun 28, 2024
1 parent a63d31c commit bb4a93d
Show file tree
Hide file tree
Showing 5 changed files with 3,737 additions and 1,807 deletions.
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"plugin:prettier/recommended"
],
"ignorePatterns": [
"tsup.config.ts"
"tsup.config.ts",
"build.config.ts"
],
"globals": {
"Atomics": "readonly",
Expand Down
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}"`,
},
},
},
],
});
Loading

0 comments on commit bb4a93d

Please sign in to comment.