From 0a04bed5551d77208063da8f63f08ea135ee192d Mon Sep 17 00:00:00 2001 From: Ritesh Kumar Date: Wed, 19 Feb 2020 15:22:06 +0530 Subject: [PATCH] fixes --- next.config.js | 6 +----- pages/api/flow-to-typescript.ts | 18 ------------------ 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/next.config.js b/next.config.js index 570747d..a74966c 100644 --- a/next.config.js +++ b/next.config.js @@ -73,11 +73,7 @@ const config = { return config; }, - target: "serverless", - - serverRuntimeConfig: { - PROJECT_ROOT: __dirname - } + target: "serverless" }; module.exports = withBundleAnalyzer(withCSS(config)); diff --git a/pages/api/flow-to-typescript.ts b/pages/api/flow-to-typescript.ts index 721f294..5e63207 100644 --- a/pages/api/flow-to-typescript.ts +++ b/pages/api/flow-to-typescript.ts @@ -1,22 +1,6 @@ import { NextApiRequest, NextApiResponse } from "next"; import convert from "@khanacademy/flow-to-ts"; import * as ts from "typescript"; -import * as fs from "fs"; -import * as path from "path"; -import getConfig from "next/config"; -const { serverRuntimeConfig } = getConfig(); - -const libSource = fs - .readFileSync( - path.join( - serverRuntimeConfig.PROJECT_ROOT, - "node_modules", - "typescript", - "lib", - "lib.d.ts" - ) - ) - .toString(); export default (req: NextApiRequest, res: NextApiResponse) => { try { @@ -47,8 +31,6 @@ export default (req: NextApiRequest, res: NextApiResponse) => { if (filename === "file.ts") { return ts.createSourceFile(filename, tsCode, undefined); } - if (filename === "lib.d.ts") - return ts.createSourceFile(filename, libSource, undefined); return ts.createSourceFile(filename, "", undefined); };