Skip to content
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

"module is not defined" Error when evaluating SSR module #11778

Closed
1 task
zhaohuanyuu opened this issue Aug 19, 2024 · 1 comment
Closed
1 task

"module is not defined" Error when evaluating SSR module #11778

zhaohuanyuu opened this issue Aug 19, 2024 · 1 comment
Labels
needs triage Issue needs to be triaged

Comments

@zhaohuanyuu
Copy link

zhaohuanyuu commented Aug 19, 2024

Astro Info

Astro                    v4.14.2
Node                     v22.6.0
System                   macOS (x64)
Package Manager          pnpm
Output                   static
Adapter                  none
Integrations             @astrojs/markdoc

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

No response

Describe the Bug

Problem Description

  1. The original issue Astro combined with vanilla-extract fails loading cssesc when rendering a content collection item #11395 has been temporarily resolved by using dependency overrides vanilla-extract-issue #1453
  2. However, when import the default configuration of prism(@astrojs/markdown-remark), the commonjs require is not defined appeared again
  3. So I used a similar method to override prismjs to continue to move forward
  4. Then other commonjs dependency errors appeared: For example:
...other commonjs dependency error

astro:vite Error when evaluating SSR module /markdoc.config.mjs:
  astro:vite |- ReferenceError: module is not defined
  astro:vite     at eval (/astro-production/node_modules/.pnpm/[email protected]/node_modules/debug/src/index.js:11:2)

astro:vite Error when evaluating SSR module /astro-production/src/content/blog/01-post.mdoc:
astro:vite |- ReferenceError: module is not defined
astro:vite at eval (/astro-production/node_modules/.pnpm/[email protected]/node_modules/debug/src/index.js:11:2)

Problem reproduction

  1. override cssesc for module is not defined error
  2. override prismjs for require is not defined error

What's the expected result?

Causes and solutions to the problem

Link to Minimal Reproducible Example

https://github.com/zhaohuanyuu/astro-reproduction/tree/module-is-not-defined

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Aug 19, 2024
@florian-lefebvre
Copy link
Member

This is not an issue with Astro, but rather an issue about ESM/CJS interop. You can look for support on our Discord server at https://astro.build/chat

@florian-lefebvre florian-lefebvre closed this as not planned Won't fix, can't repro, duplicate, stale Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

2 participants