-
Notifications
You must be signed in to change notification settings - Fork 538
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
Nitro build does not respects edge
exports in package.json for workers
#1597
Comments
edge
exports in package.json for workers
@ericfennis I believe this was fixed in #1401 and you should be able to use it with |
Guide for using edge channel: https://nitro.unjs.io/guide/getting-started#edge-release-channel Please let us know if it still doesn't works 👍🏼 |
@Hebilicious @pi0 Tnx for the quick replies, will check if it will work! |
Hmm looks like it is reading the correct file now, tnx @pi0 @Hebilicious ! But I now get an error that it can't load the wasm file, but that hasn't to do with this issue.
|
@ericfennis Do you mind making a reproduction? 🙏🏼 (if you mind opening a new issue i wouldn't miss it!) |
@pi0 Ok got the wasm file working now! But The wasm file should be located in the function directory, see vercel docs Should I make an issue for this configuration? import copy from 'rollup-plugin-copy'
//https://nitro.unjs.io/config
export default defineNitroConfig({
preset: 'vercel-edge',
esbuild: {
options: {
// This was needed to get React ro work
jsxFactory: 'React.createElement',
jsxFragment: 'React.Fragment',
},
},
rollupConfig: {
external: [
'./yoga.wasm?module',
'./resvg.wasm?module',
'./noto-sans-v27-latin-regular.ttf'
],
plugins: [
copy({
targets: [
{ src: './node_modules/@vercel/og/dist/yoga.wasm', dest: './.vercel/output/functions/__nitro.func' },
{ src: './node_modules/@vercel/og/dist/resvg.wasm', dest: './.vercel/output/functions/__nitro.func' },
// Not sure about the TTF files yet
{ src: './node_modules/@vercel/og/dist/noto-sans-v27-latin-regular.ttf', dest: './.vercel/output/static' },
{ src: './node_modules/@vercel/og/dist/noto-sans-v27-latin-regular.ttf', dest: './.vercel/output/functions/__nitro.func' },
]
})
]
}
}) But the next error I have is that the TTF file from
|
Environment
vercel-edge
Reproduction
Reproduction repo: https://github.com/ericfennis/nitro-vercel-og
Fork this repo and deploy it to Vercel to see in the logs that the function is crashed.
Describe the bug
@vercel/og together with Nitro is not working on the Vercel Edge environment dispite that config preset is set to
vercel-edge
.Probably this is same issue on other worker environments.
Note: If your run the reproduction repo it is working locally.
Additional context
I deployed the reproduction repo on vercel: https://nitro-vercel-og.vercel.app/
The Vercel Egde function log:
Digging deeper into this I found out that the wrong entry file is included in the build.
fs
is only include in the node entry file in theexports
of the package.json. So I think if the Nitro preset is set tovercel-edge
,netlify-edge
orcloudflare
. The package resolver should useworker
oredge
export in a package.json export.The vercel OG package.json
Logs
No response
The text was updated successfully, but these errors were encountered: