diff --git a/bunchee.config.js b/bunchee.config.js new file mode 100644 index 0000000..9789205 --- /dev/null +++ b/bunchee.config.js @@ -0,0 +1,23 @@ +module.exports = { + dts: true, +}; +module.exports = { + entries: [ + { + input: 'src/index.tsx', + output: [ + { + format: 'esm', + file: 'dist/react-toggle-dark-mode.esm.js', + }, + { + format: 'cjs', + file: 'dist/index.js', + }, + ], + }, + ], + dts: { + resolve: true, + }, +}; diff --git a/package.json b/package.json index c72d1e6..2a8452a 100644 --- a/package.json +++ b/package.json @@ -13,11 +13,11 @@ "node": ">=20" }, "scripts": { - "start": "tsdx watch", - "build": "tsdx build", + "start": "bunchee --watch", + "build": "bunchee", "test": "tsdx test", "lint": "tsdx lint", - "prepare": "husky && tsdx build" + "prepare": "husky && bunchee" }, "peerDependencies": { "react": ">=16" @@ -32,6 +32,13 @@ "description": "Animated dark mode toggle as seen in blogs!", "author": "Jose R. Felix (https://jfelix.info)", "module": "dist/react-toggle-dark-mode.esm.js", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/react-toggle-dark-mode.esm.js", + "require": "./dist/index.js" + } + }, "repository": { "type": "git", "url": "https://github.com/JoseRFelix/react-toggle-dark-mode" diff --git a/tsconfig.json b/tsconfig.json index 1e79b51..857a5f1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,7 +12,7 @@ "noUnusedParameters": true, "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, - "moduleResolution": "node", + "moduleResolution": "bundler", "baseUrl": "./", "paths": { "*": ["src/*", "node_modules/*"]