Closed santhoshkumarampolu closed 1 year ago
Just wanted to report this issue and then saw you already did it. I also ran across this issue yesterday. Strangely enough, my builds broke on Windows 11 and in the Linux Azure DevOps pipeline but were successful on my Mac OS Ventura.
What appears to break the builds is these two releases:
v3.1.1 (2022-10-06)
Bug Fixes
use mjs instead of esm folder
v3.1.0 (2022-09-15)
Features
support esm
That was probably since when headers-polyfill/lib/index.mjs
started causing this error.
Installing and fixing version 3.0.10
(latest before 3.1.0
) in my package.json
like so:
"resolutions": {
"headers-polyfill": "3.0.10"
}
fixed the build. Of course, this is just a temporary workaround. It would be great, if it worked out of the box on all OSes.
Chiming in as I'm hitting this error as well! The error as I see it is:
SyntaxError: The requested module './../../set-cookie-parser/lib/set-cookie.js' does not provide an export named 'splitCookiesString'
I think because set-cookie-parser
is a CommonJS so it's up to consumers of that package (and then headers-polyfill
) to handle this with a commonjs plugin like @rollup/plugin-commonjs
.
set-cookie-parser
is pretty simple so I can whip up a JavaScript module version of that and try to upstream that or we can inline it into headers-polyfill
as a utility class.
What do you think @kettanaito?
Found a workaround for my application by adding a patch to the node module ( headers-polyfill ) Modified the named export to default export in node_modules/headers-polyfill/lib/index.mjs import {splitCookiesString} from "set-cookie-parser"; to import splitCookiesString from "set-cookie-parser"; and installed yarn add patch-package postinstall-postinstall --dev added the script in package.json "scripts": { "postinstall": "patch-package" } applied the patch using yarn patch-package headers-polyfill
The above steps created a patch and build was successful in the pipeline.
I've addressed this issue in https://github.com/mswjs/headers-polyfill/pull/63. Can someone please install from that PR and verify that it's working as intended now?
I've addressed this issue in #63. Can someone please install from that PR and verify that it's working as intended now?
Not sure that will work, since it's not an ESM package, and I don't believe it will handle the cases, as @koddsson mentioned, but I opened https://github.com/mswjs/headers-polyfill/pull/65 which uses tsup to bundle set-cookie-parser
which should work everywhere we build for
This has been released in v3.2.2!
Make sure to always update to the latest version (npm i headers-polyfill@latest
) to get the newest features and bug fixes.
Predictable release automation by @ossjs/release.
Thanks, @mattcosta7. Your fix has been released in 3.2.2 🎉
Hi There, Facing the below issue , while building the application. (npm run build) Can't import the named export 'splitCookiesString' from non EcmaScript module (only default export is available) Can you please check once
import {splitCookiesString} from "set-cookie-parser";