From c3bbd4f98ce46ec97e14fb7f791d18155893e34c Mon Sep 17 00:00:00 2001 From: Nico Date: Mon, 31 Oct 2022 00:20:30 +0100 Subject: [PATCH 1/3] Node 14+ compatibility fix This PR fix errors related to npm package `extract-file` imports that no longer works with recent version of node (at least v18.x.x and v19.x.x). It seems that `extract-file` npm package.json prevent node from importing directly from files within public directory. Here is the errors I got: > Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './public/extractFiles' is not defined by "exports" in [...]/node_modules/extract-files/package.json same goes for two other exports: > Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './public/isExtractableFile' is not defined by "exports" in [...]/node_modules/extract-files/package.json and > Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './public/ReactNativeFile' is not defined by "exports" in [...]/node_modules/extract-files/package.jsonx As `extract-file` index.js exports these directly I've just updated the imports. --- public/createUploadLink.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/createUploadLink.js b/public/createUploadLink.js index 9c396e9..1641573 100644 --- a/public/createUploadLink.js +++ b/public/createUploadLink.js @@ -10,7 +10,7 @@ const { selectURI, serializeFetchParameter, } = require("@apollo/client/link/http"); -const extractFiles = require("extract-files/public/extractFiles.js"); +const { extractFiles } = require("extract-files"); const formDataAppendFile = require("./formDataAppendFile.js"); const isExtractableFile = require("./isExtractableFile.js"); From 89977ed2fac9d9e67e5da6992bc746059d50d9bb Mon Sep 17 00:00:00 2001 From: Nico Date: Mon, 31 Oct 2022 00:26:07 +0100 Subject: [PATCH 2/3] Update isExtractableFile import --- public/isExtractableFile.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/isExtractableFile.js b/public/isExtractableFile.js index a15e062..c607377 100644 --- a/public/isExtractableFile.js +++ b/public/isExtractableFile.js @@ -26,4 +26,6 @@ * const isExtractableFile = require("apollo-upload-client/public/isExtractableFile.js"); * ``` */ -module.exports = require("extract-files/public/isExtractableFile.js"); +const {isExtractableFile} = require('extract-files'); + +module.exports = isExtractableFile From d33ff87dbcdde8ebd4b31347daa0ec0a903272c8 Mon Sep 17 00:00:00 2001 From: Nico Date: Mon, 31 Oct 2022 00:27:01 +0100 Subject: [PATCH 3/3] Update ReactNativeFile import --- public/ReactNativeFile.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/ReactNativeFile.js b/public/ReactNativeFile.js index fd417ab..f9f19c0 100644 --- a/public/ReactNativeFile.js +++ b/public/ReactNativeFile.js @@ -34,4 +34,6 @@ * }); * ``` */ -module.exports = require("extract-files/public/ReactNativeFile.js"); +const {ReactNativeFile} = require('extract-files'); + +module.exports = ReactNativeFile