-
-
Notifications
You must be signed in to change notification settings - Fork 551
feat: use tough-cookie@5.1.x directly #2453
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
2e2405a
to
8d36ec5
Compare
Thanks for opening this one, @sampsonjoliver. Looks good to me, let's just make sure that this update also doesn't break any CJS consumers. |
Looks like ESM consumers are broken:
Reproduction: pnpm test:modules:browser |
Hm, I recall in #2356, it was said:
I wonder if this assumption has been validated! Perhaps we still need the esm wrapper 🤔 I may have time to look into this during my AM hours tomorrow, or else later next week. |
Hey @kettanaito, I started looking into the I can see when running the test suite with
and the response body matches the file in var cookie_1 = require("./cookie");
Object.defineProperty(exports, "Cookie", { enumerable: true, get: function () { return cookie_1.Cookie; } }); What is interesting is that I seem to be able to modify There should be no reference to tough-cookie in the code under test, yet the same error is produced. This is the question that's currently stumping me - where is the attempted import coming from? |
Also, this may be of some relevance, though it does not solve my question above: salesforce/tough-cookie#506 |
The error seems to indicate that the cookie package is CJS-only. To properly import it, we need to do a wrapper import like this: import cookiePkg from 'tough-cookie'
cookiePkg.Cookie
cookiePkg.Store
// etc. I believe we have one or two packages we import the same way in the code base. If I may ask you to look around and try this one locally, that would be highly appreciated! Thank you for putting so much work into this. Edit: Checked the code quickly and no, we've dropped such imports (likely migrated to ESM wrappers for that reason). There are references online though. |
Mirror of #2396, updating tough-cookie from ^5.0 to ^5.1.
tough-cookie
directly #2396As per that discussion, it appears the only necessary change is to update
tough-cookie
to 5.1.x in order to effectively drop the@bundled-es-modules/tough-cookie
clone.pnpm build
succeeds against 5.1.x where it fails against 5.0.x.