diff --git a/package.json b/package.json index abe807f..cc56a75 100644 --- a/package.json +++ b/package.json @@ -13,12 +13,12 @@ "bindings" ], "exports": { - "types": "./lib/index.d.ts", + "types": "./lib/types/index.d.ts", "require": "./lib/cjs/index.js", "import": "./lib/esm/index.js" }, "main": "./lib/cjs/index.js", - "types": "./lib/index.d.ts", + "types": "./lib/types/index.d.ts", "files": [ "lib", "src", @@ -29,7 +29,7 @@ "test": "jest", "test:junit": "jest --ci --reporters=default", "clean": "rimraf lib/*", - "rb": "rollup -c --configPlugin typescript", + "rb": "rollup -c --configPlugin typescript && tsc -p tsconfig.build.json", "rbw": "npm run rb --watch", "build": "npm run clean && npm run rb", "lint": "eslint ./src", @@ -75,7 +75,6 @@ "react-test-renderer": "^18.0.0", "rimraf": "^6.0.1", "rollup": "^4.19.0", - "rollup-plugin-dts": "^6.1.0", "rollup-plugin-esbuild": "^6.1.1", "ts-jest": "^29.2.2", "tslib": "^2.8.1", diff --git a/rollup.config.ts b/rollup.config.ts index a0181c1..aec1fcc 100644 --- a/rollup.config.ts +++ b/rollup.config.ts @@ -1,4 +1,3 @@ -import dts from 'rollup-plugin-dts'; import esbuild from 'rollup-plugin-esbuild'; import json from '@rollup/plugin-json'; import resolve from '@rollup/plugin-node-resolve'; @@ -33,12 +32,4 @@ export default [ plugins, external, }, - { - input: 'src/index.ts', - plugins: [dts(), json()], - output: { - file: 'lib/index.d.ts', - format: 'es', - }, - }, ]; diff --git a/tsconfig.build.json b/tsconfig.build.json new file mode 100644 index 0000000..f80be94 --- /dev/null +++ b/tsconfig.build.json @@ -0,0 +1,14 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "rootDir": "src", + "declaration": true, + "declarationDir": "lib/types", + "emitDeclarationOnly": true, + "sourceMap": false, + "sourceRoot": null, + "noEmit": false + }, + "include": ["src"], + "exclude": ["node_modules", "lib", "dist", "example", "**/*.test.ts", "**/*.test.tsx"] +}