From 1cbfcd22190703da081e4b89f83c9dcb30b4e073 Mon Sep 17 00:00:00 2001 From: Sujith Date: Fri, 3 Mar 2023 01:35:17 +0530 Subject: [PATCH] fix: require to import with assert for .json Signed-off-by: Sujith --- apps/reaction/src/checkNodeVersion.cjs | 2 +- apps/reaction/tests/util/setupJestTests.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/reaction/src/checkNodeVersion.cjs b/apps/reaction/src/checkNodeVersion.cjs index b91bd5eb787..cfbbe7ae4d7 100644 --- a/apps/reaction/src/checkNodeVersion.cjs +++ b/apps/reaction/src/checkNodeVersion.cjs @@ -5,7 +5,7 @@ // do not support ES modules. const semver = require("semver"); -const packageJson = require("../package.json"); +import * as packageJson from "./package.json" assert { type: "json" }; const requiredNodeVersion = packageJson.engines.node; if (!semver.satisfies(process.version, requiredNodeVersion)) { diff --git a/apps/reaction/tests/util/setupJestTests.js b/apps/reaction/tests/util/setupJestTests.js index 6b9aeabb62e..b4d9fc55b7f 100644 --- a/apps/reaction/tests/util/setupJestTests.js +++ b/apps/reaction/tests/util/setupJestTests.js @@ -2,7 +2,7 @@ import { createRequire } from "module"; const require = createRequire(import.meta.url); -const jestProcessEnv = require("./jestProcessEnv.json"); +import * as jestProcessEnv from "./jestProcessEnv.json" assert { type: "json" }; process.env = Object.assign(process.env, { ...jestProcessEnv