Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jun 20, 2023. It is now read-only.

Commit d3e9a8a

Browse files
cjdellnchanged
authored andcommitted
fix: Support tsconfig.json with comments (#1129)
* fix: Support tsconfig.json with comments * fix: Move comment-json definitions to dev deps
1 parent 5fc78d0 commit d3e9a8a

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
},
3131
"homepage": "https://github.com/fuse-box/fuse-box#readme",
3232
"devDependencies": {
33+
"@types/comment-json": "^1.1.1",
3334
"@types/node": "^6.0.74",
3435
"cheerio": "^0.22.0",
3536
"commitizen": "^2.9.6",
@@ -75,6 +76,7 @@
7576
"base64-js": "^1.2.0",
7677
"chokidar": "^1.6.1",
7778
"clean-css": "^4.1.9",
79+
"comment-json": "^1.1.3",
7880
"escodegen": "^1.8.1",
7981
"express": "^4.14.0",
8082
"fliplog": "^0.3.13",
@@ -119,4 +121,4 @@
119121
"path": "cz-conventional-changelog"
120122
}
121123
}
122-
}
124+
}

src/core/TypescriptConfig.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { ensureUserPath, findFileBackwards } from "../Utils";
44
import { ScriptTarget } from "./File";
55
import * as fs from "fs";
66
import { Config } from "../Config";
7+
import * as json from 'comment-json';
78

89
const CACHED: { [path: string]: any } = {};
910

@@ -86,7 +87,7 @@ export class TypescriptConfig {
8687
if (configFile) {
8788
this.context.log.echoInfo(`Typescript config file: ${configFile.replace(this.context.appRoot, "")}`);
8889
configFileFound = true;
89-
config = require(configFile);
90+
config = json.parse(fs.readFileSync(configFile).toString());
9091
}
9192

9293

0 commit comments

Comments
 (0)