-
Notifications
You must be signed in to change notification settings - Fork 100
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
Chore/docs and example fonts #232
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
You should make sure to clone any request you use, in order to not break other middleware. For example you can only call `const body = await ctx.request.clone().json();` once on a request. | ||
|
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.
can we not just pass a clone of the request to each middleware?
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.
was thinking the same - not sure what the overhead is or if there's any downside
// without this line, this type of importing fonts doesn't work for some reason | ||
export const runtime = "edge"; | ||
|
||
const regularFont = fetch( | ||
new URL("/public/Inter-Regular.ttf", import.meta.url) | ||
).then((res) => res.arrayBuffer()); |
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.
It took me several attempts to figure this out, but for the nodejs runtime deployed to Vercel, it seems like the most reliable way was to use a combination of process.cwd()
and fs
functions:
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.
dang thats tricky - thanks for following up. Will incorporate
name: "Inter", | ||
data: regularFontData, | ||
weight: 400, | ||
}, | ||
{ | ||
name: "Inter", | ||
data: boldFontData, | ||
weight: 700, |
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.
typos: should be regularFont
and boldFont
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.
they also need to be awaited
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.
think you're missing line 16
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.
oops missed that sorry
@davidfurlong i have added middleware docs in #240 and a more focused custom middleware example in #248 - these aspects can be removed from this pr if you agree |
Change Summary