Skip to content

Commit

Permalink
Use get-tsconfig to parse resolved tsconfigs
Browse files Browse the repository at this point in the history
  • Loading branch information
peschee committed Feb 2, 2024
1 parent 1ea496a commit 28b7598
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
20 changes: 20 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"@mdn/browser-compat-data": "^4.0.0",
"@web/dev-server-core": "^0.7.0",
"esbuild": "^0.19.11",
"get-tsconfig": "^4.7.2",
"parse5": "^6.0.1",
"ua-parser-js": "^1.0.33"
},
Expand Down
4 changes: 3 additions & 1 deletion src/EsbuildPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
setTextContent,
} from '@web/dev-server-core/dist/dom5';
import { parse as parseHtml, serialize as serializeHtml } from 'parse5';
import { parseTsconfig } from 'get-tsconfig';

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

Expand Down Expand Up @@ -61,7 +62,8 @@ export class EsbuildPlugin implements Plugin {
this.config = config;
this.logger = logger;
if (this.esbuildConfig.tsconfig) {
this.tsconfigRaw = await promisify(fs.readFile)(this.esbuildConfig.tsconfig, 'utf8');
const parsedTsconfig = await parseTsconfig(this.esbuildConfig.tsconfig);
this.tsconfigRaw = parsedTsconfig ? JSON.stringify(parsedTsconfig) : await promisify(fs.readFile)(this.esbuildConfig.tsconfig, 'utf8');
}
}

Expand Down

0 comments on commit 28b7598

Please sign in to comment.