diff --git a/lib/package.json b/lib/package.json index 71f18ba..4ae435b 100644 --- a/lib/package.json +++ b/lib/package.json @@ -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", ".": { diff --git a/lib/tsup.config.ts b/lib/tsup.config.ts index 9138520..70ba7a4 100644 --- a/lib/tsup.config.ts +++ b/lib/tsup.config.ts @@ -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,