diff --git a/build.config.ts b/build.config.ts new file mode 100644 index 0000000..9b29248 --- /dev/null +++ b/build.config.ts @@ -0,0 +1,24 @@ +import { rmSync, writeFileSync } from "node:fs"; +import { defineBuildConfig } from "unbuild"; + +export default defineBuildConfig({ + outDir: "dist", + declaration: true, + clean: true, + entries: [ + { + builder: "rollup", + input: "./src/index", + }, + ], + rollup: { + emitCJS: true, + }, + hooks: { + "rollup:done": () => { + rmSync("./dist/index.d.cts"); + rmSync("./dist/index.d.mts"); + writeFileSync("./dist/index.mjs", `export * from './index.cjs';`); + }, + }, +}); diff --git a/package.json b/package.json index dc027f9..17d3d8c 100644 --- a/package.json +++ b/package.json @@ -10,18 +10,18 @@ ".": { "types": "./dist/index.d.ts", "import": { - "types": "./dist/index.d.mts", + "types": "./dist/index.d.ts", "default": "./dist/index.mjs" }, "require": { - "types": "./dist/index.d.cts", + "types": "./dist/index.d.ts", "default": "./dist/index.cjs" } } }, "main": "./dist/index.cjs", "module": "./dist/index.mjs", - "types": "./dist/index.d.cts", + "types": "./dist/index.d.ts", "files": [ "dist" ],