You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Server does run on port 8085, but avatars are missing from footer and log shows error:
[error] /src/components/AvatarList.astro
Buffer is not defined
If it helps, the following info/notice gets logged during "pnpm build" but I think that is not related:
building client
transforming (115) node_modules/.pnpm/@algolia[email protected]/node_mod'default' is not exported by 'node_modules/.pnpm/@[email protected]_ozja46d2hdfcawewer6noq2pdi/node_modules/@docsearch/react/dist/esm/index.js'
'default' is not exported by 'node_modules/.pnpm/@[email protected]_ozja46d2hdfcawewer6noq2pdi/node_modules/@docsearch/react/dist/esm/index.js'
A similar issue was solved #4323, and node's Buffer incompatibility with Deno is discussed with various suggested fixes in this medium article
I was able to fix this in production mode - showing the Avatars with no error - with an import in the frontmatter:
import { Buffer } from "https://deno.land/std/io/buffer.ts";
and rewriting the node.js style "Buffer" to a deno style "Buffer":
Even with the VS deno code extension enabled in the Astro workspace, the deno import caused the linter to complain: "An import path cannot end with a '.ts' extension. Consider importing 'https://deno.land/std/io/buffer.js' instead.ts(2691)"
But more important the fix in production mode caused Astro dev mode to break, so perhaps Astro dev server doesn't like using the Deno Buffer?
I thought of using a ternary operator to check the environment if Astro is in dev or production mode, and make a conditional import, but that seemed a bit of a kluge.
Happy to do the PR if the way above is generally OK.
That wouldn't work. Perhaps the Deno adapter can import the Buffer and set it as a global? That's the only solution I can forsee.
We don't intend to make every example compatible with every production runtime though. That would be impossible as many Node packages only work in Node. Going to close the issue for that reason, but if you come up with something please do submit a PR. Thanks!
What version of
astro
are you using?1.5.2
Are you using an SSR adapter? If so, which one?
Deno
What package manager are you using?
pnpm
What operating system are you using?
Linux
Describe the Bug
To reproduce:
pnpm create astro@latest -- --template docs
pnpm astro add deno
pnpm build
pnpm preview
Server does run on port 8085, but avatars are missing from footer and log shows error:
[error] /src/components/AvatarList.astro
Buffer is not defined
If it helps, the following info/notice gets logged during "pnpm build" but I think that is not related:
building client
transforming (115) node_modules/.pnpm/@algolia[email protected]/node_mod'default' is not exported by 'node_modules/.pnpm/@[email protected]_ozja46d2hdfcawewer6noq2pdi/node_modules/@docsearch/react/dist/esm/index.js'
'default' is not exported by 'node_modules/.pnpm/@[email protected]_ozja46d2hdfcawewer6noq2pdi/node_modules/@docsearch/react/dist/esm/index.js'
A similar issue was solved #4323, and node's Buffer incompatibility with Deno is discussed with various suggested fixes
in this medium article
I was able to fix this in production mode - showing the Avatars with no error - with an import in the frontmatter:
import { Buffer } from "https://deno.land/std/io/buffer.ts";
and rewriting the node.js style "Buffer" to a deno style "Buffer":
Even with the VS deno code extension enabled in the Astro workspace, the deno import caused the linter to complain:
"An import path cannot end with a '.ts' extension. Consider importing 'https://deno.land/std/io/buffer.js' instead.ts(2691)"
But more important the fix in production mode caused Astro dev mode to break, so perhaps Astro dev server doesn't like using the Deno Buffer?
I thought of using a ternary operator to check the environment if Astro is in dev or production mode, and make a conditional import, but that seemed a bit of a kluge.
Happy to do the PR if the way above is generally OK.
Link to Minimal Reproducible Example
https://codesandbox.io/s/github/withastro/astro/tree/latest/examples/docs
Participation
The text was updated successfully, but these errors were encountered: