Skip to content

Commit

Permalink
Fix types for CJS bundle (#417)
Browse files Browse the repository at this point in the history
  • Loading branch information
wavded authored Dec 4, 2024
1 parent 1ae375e commit b43e613
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
14 changes: 10 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "connect-redis",
"description": "Redis session store for Connect",
"version": "8.0.0",
"version": "8.0.1",
"author": "TJ Holowaychuk <tj@vision-media.ca>",
"contributors": [
"Marc Harter <wavded@gmail.com>"
Expand All @@ -13,8 +13,14 @@
"types": "./dist/connect-redis.d.ts",
"exports": {
".": {
"import": "./dist/connect-redis.js",
"require": "./dist/connect-redis.cjs"
"import": {
"types": "./dist/connect-redis.d.ts",
"default": "./dist/connect-redis.js"
},
"require": {
"types": "./dist/connect-redis.d.cts",
"default": "./dist/connect-redis.cjs"
}
}
},
"scripts": {
Expand All @@ -27,7 +33,7 @@
},
"repository": {
"type": "git",
"url": "git@github.com:tj/connect-redis.git"
"url": "git+ssh://git@github.com/tj/connect-redis.git"
},
"devDependencies": {
"@eslint/js": "^9.15.0",
Expand Down
11 changes: 10 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {copyFileSync} from "node:fs"
import dts from "vite-plugin-dts"
import {defineConfig} from "vitest/config"

Expand All @@ -18,7 +19,15 @@ export default defineConfig({
target: "node18",
},
plugins: [
dts({include: ["index.ts"], rollupTypes: true, insertTypesEntry: true}),
// @ts-expect-error Type mismatch, revisit.
dts({
include: ["index.ts"],
rollupTypes: true,
insertTypesEntry: true,
afterBuild: () => {
copyFileSync("dist/connect-redis.d.ts", "dist/connect-redis.d.cts")
},
}),
],
test: {
include: ["**/*_test.[jt]s"],
Expand Down

0 comments on commit b43e613

Please sign in to comment.