Closed matthewmueller closed 5 years ago
Hi There,
Pretty sure this is related to this issue, Our production nextjs project was breaking on iOS 9.3 and we could not figure out why for a really long time. Took another shot at it recently and found that the culprit was this package. I copied the source code into my project manually and it ended up working fine
Looks like there are a few ways to do this:
This is now fixed in v1.1.0. Apologies for the delay.
FWIW, the linked post above is aimed more at library consumers rather than authors. The method I chose, which makes more sense for a library author, is to split the browser and node.js code into separate files, and then use the main
and browser
fields in package.json
to identify these files. Node.js loads the main
file, Webpack will automatically load the browser
file when bundling for a browser.
https://docs.npmjs.com/files/package.json#main
(This is essentially what @matthewmueller suggested)
awesome, thanks @nfriedly!
Didn't test but while looking at the source again I realized that the server-side
require('cookie')
is most likely ending up on the client-side.I think we should maybe break the cookie parser out into another file that webpack/next will conditionally load. I think webpack respects the
browser
field so maybe we could use that.