Skip to content

Astro v6 with cloudflare adapter does not work with <Code/> component #439

Description

@thelazylamaGit

What version of Expressive Code are you using?

0.41.7

What tools are you using Expressive Code with?

Astro

What package manager are you using?

pnpm

What operating system are you using?

Windows

What browser are you using?

Chrome

Describe the Bug

With the new Astro 6 vite environments api setup for the Cloudflare adapter, the <Code/> component gives the following error when using the default prerenderEnvironment: 'workerd'

module is not defined

    at runInRunnerObject (workers/runner-worker/index.js:106:3)
    at render (C:/Files/Code/Web/astro-site/node_modules/.vite/deps_ssr/astro_content_runtime.js?v=2f723dd5:688:28)
    at null.<anonymous> (C:/Files/Code/Web/astro-site/src/pages/lab/[id].astro:11:21)
    at callComponentAsTemplateResultOrResponse (C:/Files/Code/Web/astro-site/node_modules/.vite/deps_ssr/chunk-VQFMSOFH.js?v=2f723dd5:586:25)
    at renderToReadableStream (C:/Files/Code/Web/astro-site/node_modules/.vite/deps_ssr/chunk-VQFMSOFH.js?v=2f723dd5:534:26)
    at renderPage (C:/Files/Code/Web/astro-site/node_modules/.vite/deps_ssr/chunk-H75ZG7DM.js?v=2f723dd5:594:14)
    at lastNext (C:/Files/Code/Web/astro-site/node_modules/.vite/deps_ssr/chunk-W35EKWDU.js?v=2f723dd5:1667:25)
    at callMiddleware (C:/Files/Code/Web/astro-site/node_modules/.vite/deps_ssr/chunk-W35EKWDU.js?v=2f723dd5:677:10)
    at _RenderContext.render (C:/Files/Code/Web/astro-site/node_modules/.vite/deps_ssr/chunk-W35EKWDU.js?v=2f723dd5:1701:73)
    at DevApp.render (C:/Files/Code/Web/astro-site/node_modules/.vite/deps_ssr/chunk-W35EKWDU.js?v=2f723dd5:2611:20)

The same error was occuring with the built in Astro Code component but was able to be fixed. withastro/astro#15284

It appears it's just the Code component that is affected as using markdown code blocks instead bypasses the error.

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds reproductionWe cannot reproduce this issue and need an example project

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions