-
Notifications
You must be signed in to change notification settings - Fork 30
fix: vercel serialization bug #108
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
Conversation
This pull request has been linked to Shortcut Story #199363: Fix vercel serialization bug. |
packages/sdk/vercel/tsconfig.json
Outdated
"types": ["jest", "node"], | ||
"skipLibCheck": true | ||
"skipLibCheck": true, | ||
"esModuleInterop": true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need esModuleInterop
to be able to import package.json as default import and be consistent with our build instructions/output
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both the cloudflare and server-node packages don't need esModuleInterop and all the tests passed without it. Did you have an issue without it? Two syntaxes which should work:
import { name, version } from '../package.json';
//or
import * as packageJson from '../package.json';
Can you kindly try these please? Thank you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f I try and use the package with the named import, I see this error below,
Failed to compile
../js-core/packages/sdk/vercel/dist/esm/src/createPlatformInfo.js
Can't import the named export 'name' (imported as 'name') from default-exporting module (only default export is available)
This error occurred during the build process of the example project and can only be fixed by changing the import.
Using a default import works fine, however then without esModuleInterOp the tests fail as a default import from the package.json isn’t supported
he tests will pass since they use the tsconfig in the package, but have you tried using the built package in a real world setting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#109 has an example nextjs app which works without esModuleInterop and works with the vercel sdk with the serialization fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking this on and being so quick with it!
I've made a few changes as discussed over slack and I think we're good to go.
I'll follow up with vercel about updating their SDK to support returning a non parsed config string
Co-authored-by: Yusinto Ngadiman <yusinto@gmail.com>
…o dep. minor package.json changes.
Closing this in favour of #114. |
The same cloudflare fix in #107 is applied to vercel in this PR.
@monsagri can you please test this branch in your example app?