Skip to content

Commit 61a831e

Browse files
authored
fix: parse with json5
1 parent 70e7fe8 commit 61a831e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

example/gulpfile.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,19 @@ const rollup = require("rollup");
44
const typescriptPlugin = require("@rollup/plugin-typescript");
55
const { nodeResolve } = require("@rollup/plugin-node-resolve");
66
const through2 = require("through2");
7+
const fs = require("fs");
8+
const json5 = require("json5");
79

810
const LIB_SOURCE = "../src/**/*.ts";
911
const tsConfigPath = "../tsconfig.json";
1012

13+
// Read and parse tsconfig.json with json5
14+
const tsConfig = json5.parse(fs.readFileSync(tsConfigPath, "utf-8"));
15+
1116
const transpileLibTypescript = () =>
1217
src(LIB_SOURCE, { sourcemaps: true })
1318
.pipe(through2.obj(function (file, _, cb) {
1419
if (file.isBuffer()) {
15-
const tsConfig = require(tsConfigPath);
1620
const result = ts.transpileModule(file.contents.toString(), {
1721
compilerOptions: tsConfig.compilerOptions,
1822
fileName: file.path,

0 commit comments

Comments
 (0)