Skip to content

Commit 41a5fbb

Browse files
authored
feat: Add ESM support for @ts-rest/express (#161)
1 parent 832b645 commit 41a5fbb

5 files changed

Lines changed: 23 additions & 15 deletions

File tree

.changeset/fast-falcons-fix.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@ts-rest/express': patch
3+
---
4+
5+
Make @ts-rest/express ESM compatible

libs/ts-rest/express/project.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
"projectType": "library",
66
"targets": {
77
"build": {
8-
"executor": "@nrwl/js:swc",
8+
"executor": "@nrwl/rollup:rollup",
99
"outputs": ["{options.outputPath}"],
1010
"options": {
11+
"project": "libs/ts-rest/express/package.json",
1112
"outputPath": "dist/libs/ts-rest/express",
1213
"main": "libs/ts-rest/express/src/index.ts",
1314
"tsConfig": "libs/ts-rest/express/tsconfig.lib.json",
14-
"assets": ["libs/ts-rest/express/*.md"],
15+
"format": ["esm", "cjs"],
16+
"compiler": "tsc",
1517
"rollupConfig": "tools/scripts/rollup.config.js",
1618
"generateExportsField": true
1719
}

libs/ts-rest/express/src/lib/ts-rest-express.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ import {
1313
Without,
1414
ZodInferOrType,
1515
} from '@ts-rest/core';
16-
import type { IRouter, NextFunction, Request, Response } from 'express';
16+
import type {
17+
IRouter,
18+
NextFunction,
19+
Request,
20+
Response,
21+
} from 'express-serve-static-core';
1722
import type { IncomingHttpHeaders } from 'http';
1823

1924
export function getValue<

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@
6868
"expo-structured-headers": "~2.2.1",
6969
"expo-updates": "~0.14.3",
7070
"express": "4.18.1",
71-
"express-serve-static-core": "^0.1.1",
7271
"graphql": "^16.6.0",
7372
"multer": "1.4.5-lts.1",
7473
"next": "13.0.0",
@@ -141,6 +140,7 @@
141140
"@testing-library/react-native": "11.5.0",
142141
"@types/cors": "^2.8.12",
143142
"@types/express": "4.17.14",
143+
"@types/express-serve-static-core": "^4.17.33",
144144
"@types/jest": "28.1.8",
145145
"@types/node": "18.11.9",
146146
"@types/react": "18.0.25",

pnpm-lock.yaml

Lines changed: 7 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)