how to optimize so that next js can see it after deployment in vercel?
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch [email protected] for the project I'm working on.
Here is the diff that solved my problem:
diff --git a/node_modules/tinify/lib/tinify/Client.js b/node_modules/tinify/lib/tinify/Client.js
index 09b1eb7..e9d4064 100644
--- a/node_modules/tinify/lib/tinify/Client.js
+++ b/node_modules/tinify/lib/tinify/Client.js
@@ -7,7 +7,7 @@ const proxyAgent = require("proxying-agent");
const package_json_1 = require("../../package.json");
const tinify_1 = require("../tinify");
const boundaries = /-----BEGIN CERTIFICATE-----[\s\S]+?-----END CERTIFICATE-----\n/g;
-const data = fs.readFileSync(`${__dirname}/../data/cacert.pem`).toString();
+const data = fs.readFileSync(`${process.cwd()}/cacert.pem`).toString();
class Client {
/** @internal */
constructor(key, appIdentifier, proxy) {
This issue body was partially generated by patch-package.
Hi Sabrenda,
Thanks for the patch. I understand that __dirname can be '/' on development (https://github.com/vercel/next.js/discussions/14341). Is that why it was not working for you?
The approach of getting the current working dir (process.cwd()) might break the library for other people. We will have to implement a solution that works for both.
Would you be able to share with me how you are using the Tinify client with Vercel? That would help us reproduce the issue.