This commit is contained in:
Ritesh Kumar committed 2020-02-19 15:22:06 +05:30
1 parent 96923adae2
commit 0a04bed555
2 files changed
+1 -23

No files matched your search

+1 -5
View File
@@ -73,11 +73,7 @@ const config = {
return config;
},
target: "serverless",
serverRuntimeConfig: {
PROJECT_ROOT: __dirname
}
target: "serverless"
};
module.exports = withBundleAnalyzer(withCSS(config));
-18
View File
@@ -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);
};