jaydenseric/apollo-upload-client

latest version of the package failed to compile

Cavdy opened this issue · 2 comments

Cavdy commented

Hello,
I installed the latest version of the package(18.0.1) but my project failed to compile, so I had to revert back to version(17.0.0)

the error message below
Android Bundling failed 2616ms Unable to resolve "apollo-upload-client" from "services/client.ts"

MicrosoftTeams-image

Hello, most likely you need to update your imports from apollo-upload-client to be deep imports, as per the v18 changelog entry major changes:

https://github.com/jaydenseric/apollo-upload-client/releases/tag/v18.0.0

  • Removed the package main index module; deep imports must be used. To migrate:

    - import {
    -   createUploadLink,
    -   formDataAppendFile,
    -   isExtractableFile
    - } from "apollo-upload-client";
    + import createUploadLink from "apollo-upload-client/createUploadLink.mjs";
    + import formDataAppendFile from "apollo-upload-client/formDataAppendFile.mjs";
    + import isExtractableFile from "apollo-upload-client/isExtractableFile.mjs";
Cavdy commented

In order for the new import to work for me, I had to add the below code to my metro.config.js

defaultConfig.resolver.sourceExts.push('mjs');