Skip to content

Commit 28b7598

Browse files
committed
Use get-tsconfig to parse resolved tsconfigs
1 parent 1ea496a commit 28b7598

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

package-lock.json

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
"@mdn/browser-compat-data": "^4.0.0",
6161
"@web/dev-server-core": "^0.7.0",
6262
"esbuild": "^0.19.11",
63+
"get-tsconfig": "^4.7.2",
6364
"parse5": "^6.0.1",
6465
"ua-parser-js": "^1.0.33"
6566
},

src/EsbuildPlugin.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
setTextContent,
1919
} from '@web/dev-server-core/dist/dom5';
2020
import { parse as parseHtml, serialize as serializeHtml } from 'parse5';
21+
import { parseTsconfig } from 'get-tsconfig';
2122

2223
import { getEsbuildTarget } from './getEsbuildTarget.js';
2324

@@ -61,7 +62,8 @@ export class EsbuildPlugin implements Plugin {
6162
this.config = config;
6263
this.logger = logger;
6364
if (this.esbuildConfig.tsconfig) {
64-
this.tsconfigRaw = await promisify(fs.readFile)(this.esbuildConfig.tsconfig, 'utf8');
65+
const parsedTsconfig = await parseTsconfig(this.esbuildConfig.tsconfig);
66+
this.tsconfigRaw = parsedTsconfig ? JSON.stringify(parsedTsconfig) : await promisify(fs.readFile)(this.esbuildConfig.tsconfig, 'utf8');
6567
}
6668
}
6769

0 commit comments

Comments
 (0)