Skip to content

Commit

Permalink
build: add cjs build to avoid issues with jest, resolves #144
Browse files Browse the repository at this point in the history
  • Loading branch information
nerdyman committed Sep 14, 2024
1 parent dc98418 commit c878402
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@
"node": ">=16.9.0"
},
"sideEffects": false,
"type": "module",
"main": "dist/index.cjs",
"types": "dist/index.d.ts",
"module": "dist/index.mjs",
"types": "dist/index.d.mts",
"exports": {
"./package.json": "./package.json",
".": {
Expand Down
8 changes: 7 additions & 1 deletion lib/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ export default defineConfig((options) => ({
clean: !options.watch,
dts: true,
entry: ['src/index.ts'],
format: ['esm'],
format: ['esm', 'cjs'],
outExtension: (context) => {
return {
dts: context.format === 'esm' ? '.d.mts' : '.d.ts',
js: context.format === 'esm' ? '.mjs' : '.cjs',
};
},
minify: !options.watch,
target,
sourcemap: true,
Expand Down

0 comments on commit c878402

Please sign in to comment.