Skip to content

Commit 9aa668a

Browse files
committed
chore(rollup.config.js): remove build warning message
1 parent 1ff7743 commit 9aa668a

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

rollup.config.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ export default {
55
input: "./src/index.ts",
66
output: {
77
file: "./build/index.js",
8-
format: "cjs"
8+
format: "cjs",
9+
exports: "named"
910
},
10-
plugins: [typescript(), uglify()]
11+
plugins: [typescript(), uglify()],
12+
external: ['next', 'http-proxy']
1113
};

src/index.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { NextApiResponse, NextApiRequest } from "next";
2-
import { ServerOptions } from "http-proxy";
3-
import httpProxy from "http-proxy";
2+
import httpProxy, { ServerOptions } from "http-proxy";
43
export interface NextHttpProxyMiddlewareOptions extends ServerOptions {
54
pathRewrite?: { [key: string]: string };
65
}
@@ -47,12 +46,12 @@ const httpProxyMiddleware = async (
4746
if (pathRewrite) {
4847
req.url = rewritePath(req.url as string, pathRewrite);
4948
}
50-
if(["POST", "PUT"].indexOf(req.method as string) >= 0 && typeof req.body === "object"){
49+
if (["POST", "PUT"].indexOf(req.method as string) >= 0 && typeof req.body === "object") {
5150
req.body = JSON.stringify(req.body);
5251
}
5352
proxy
5453
.once("proxyReq", ((proxyReq: any, req: any): void => {
55-
if(["POST", "PUT"].indexOf(req.method as string) >= 0 && typeof req.body === "string"){
54+
if (["POST", "PUT"].indexOf(req.method as string) >= 0 && typeof req.body === "string") {
5655
proxyReq.write(req.body);
5756
proxyReq.end();
5857
}

0 commit comments

Comments
 (0)