From 2dfc5421830f51d3edb48171ce28205ab6da238b Mon Sep 17 00:00:00 2001 From: RahulGautamSingh Date: Thu, 18 Jul 2024 00:03:36 +0530 Subject: [PATCH] chore: enabled json imports (#30223) --- lib/expose.cjs | 6 ++++-- tsconfig.app.json | 1 - tsconfig.json | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/expose.cjs b/lib/expose.cjs index c2d3c5d22e6002..882b46625fe58f 100644 --- a/lib/expose.cjs +++ b/lib/expose.cjs @@ -2,9 +2,11 @@ /** * returns renovates package.json - * @type {import('./types').RenovatePackageJson} */ -const pkg = (() => require('../package.json'))(); +const path = (() => require('path'))(); +// need to use dynamic strings so that typescript does not include package.json in dist folder after compilation +const filePath = path.join(__dirname, '..', 'package.json'); +const pkg = (() => require(filePath))(); /** * return's re2 diff --git a/tsconfig.app.json b/tsconfig.app.json index 01612b0cf5c494..8f46a98c574dcb 100644 --- a/tsconfig.app.json +++ b/tsconfig.app.json @@ -2,7 +2,6 @@ "extends": "./tsconfig", "compilerOptions": { "declaration": true, - "resolveJsonModule": false, "sourceMap": true, "inlineSources": true, "importHelpers": true, diff --git a/tsconfig.json b/tsconfig.json index 6c4727e35c7e53..59f52da38320a9 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,7 +10,7 @@ "sourceMap": true, "allowSyntheticDefaultImports": true, "esModuleInterop": true, - "resolveJsonModule": false, + "resolveJsonModule": true, "noUnusedLocals": true, "noImplicitOverride": true, "experimentalDecorators": true,