From cf771368305dabed8d0939b293dfe30e181e2260 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Mon, 6 Dec 2021 12:10:09 -0500 Subject: [PATCH] Fixes CI --- webpack.config.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index 7f08bc6..ee6e4bd 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -6,7 +6,7 @@ /* eslint-disable @typescript-eslint/strict-boolean-expressions */ /* eslint-disable @typescript-eslint/prefer-optional-chain */ 'use strict'; -const { execFileSync } = require('child_process'); +const { spawnSync } = require('child_process'); const path = require('path'); const CircularDependencyPlugin = require('circular-dependency-plugin'); const { CleanWebpackPlugin: CleanPlugin } = require('clean-webpack-plugin'); @@ -529,14 +529,20 @@ class InlineChunkHtmlPlugin { } } +/** + * @param { string } configFile + * @returns { string } + */ function resolveTSConfig(configFile) { - const data = execFileSync('yarn', ['tsc', `-p ${configFile}`, '--showConfig'], { + const result = spawnSync('yarn', ['tsc', `-p ${configFile}`, '--showConfig'], { cwd: __dirname, encoding: 'utf8', shell: true, }); - const index = data.indexOf('\n'); - const json = JSON5.parse(data.substr(index + 1)); + const data = result.stdout; + const start = data.indexOf('{'); + const end = data.lastIndexOf('}') + 1; + const json = JSON5.parse(data.substring(start, end)); return json; }