Skip to content

[v6] <Prism /> component throws an error on pnpm astro dev when used with the Cloudflare Workers integration #15722

@rururux

Description

@rururux

Astro Info

Astro                    v6.0.0-beta.17
Vite                     v7.3.1
Node                     v25.4.0
System                   Windows (x64)
Package Manager          pnpm
Output                   static
Adapter                  @astrojs/cloudflare (v13.0.0-beta.11)
Integrations             none

(and @astrojs/prism@4.0.0-beta.2)

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

Running pnpm astro dev with the <Prism /> component from @astrojs/prism and the Cloudflare Workers integration in the latest beta version of Astro throws the following error:

02:23:31 [ERROR] [vite] Internal server error: require is not defined
      at null.<anonymous> (.../astro-v6-cf-prism/node_modules/.pnpm/prismjs@1.30.0/node_modules/prismjs/components/index.js:1:47)
      at Object.runInlinedModule (workers/runner-worker.js:1314:56)
      at CustomModuleRunner.directRequest (workers/runner-worker.js:1166:80)
      at CustomModuleRunner.cachedRequest (workers/runner-worker.js:1084:73)

What's the expected result?

The component should work without any errors.

Link to Minimal Reproducible Example

https://github.com/rururux/astro-v6-cf-prism

Participation

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

Metadata

Metadata

Assignees

Labels

- P3: minor bugAn edge case that only affects very specific usage (priority)needs triageIssue needs to be triagedpkg: astroRelated to the core `astro` package (scope)pkg: cloudflareRelated to the Cloudflare adapter

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions