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

Using bind: in Svelte 5 in conjunction with React causes error in MDX files. #11615

Closed
1 task
Hugos68 opened this issue Aug 4, 2024 · 0 comments · Fixed by #11624
Closed
1 task

Using bind: in Svelte 5 in conjunction with React causes error in MDX files. #11615

Hugos68 opened this issue Aug 4, 2024 · 0 comments · Fixed by #11624
Assignees
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) pkg: mdx Issues pertaining to `@astrojs/mdx` integration pkg: react Related to React (scope) pkg: svelte Related to Svelte (scope)

Comments

@Hugos68
Copy link

Hugos68 commented Aug 4, 2024

Astro Info

Astro                    v4.13.1
Node                     v20.14.0
System                   Windows (x64)
Package Manager          pnpm
Output                   static
Adapter                  none
Integrations             @astrojs/svelte
                         @astrojs/react
                         @astrojs/mdx

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

Not relevant

Describe the Bug

When running astro build the build unexpectedly fails and spits out the following error:

> astro build

2:29:22 PM [vite-plugin-svelte] You are using Svelte 5.0.0-next.208. Svelte 5 support is experimental, breaking changes can occur in any release until this notice is removed.
work in progress:
 - svelte-inspector is disabled until dev mode implements node to code mapping

14:29:22 [types] Generated 187ms
14:29:22 [build] output: "static"
14:29:22 [build] directory: C:\Users\hugok\repositories\repro-astro-svelte\dist\
14:29:22 [build] Collecting build info...
14:29:22 [build] ✓ Completed in 230ms.
14:29:22 [build] Building static entrypoints...
14:29:23 [vite] ✓ built in 1.45s
14:29:23 [build] ✓ Completed in 1.49s.

 building client (vite) 
14:29:24 [vite] ✓ 101 modules transformed.
14:29:24 [vite] dist/_astro/Foo.BqSHm6A9.js          0.11 kB │ gzip:  0.12 kB
14:29:24 [vite] dist/_astro/client-v5.2QKS7mx9.js    8.13 kB │ gzip:  3.66 kB
14:29:24 [vite] dist/_astro/client.5I5BMcNS.js     142.41 kB │ gzip: 45.91 kB
14:29:24 [vite] ✓ built in 1.08s

 generating static routes 
14:29:24 ▶ src/pages/index.mdx
14:29:24   └─ /index.html[TypeError] Cannot read properties of undefined (reading 'title')
  Hint:
    This issue often occurs when your MDX component encounters runtime errors.
  Stack trace:
    at copy_payload (file:///C:/Users/hugok/repositories/repro-astro-svelte/dist/chunks/_@astro-renderers_VtnIBQy8.mjs:25:16)
    at Tester (file:///C:/Users/hugok/repositories/repro-astro-svelte/dist/chunks/_@astro-renderers_VtnIBQy8.mjs:293:18)
    at Xc (C:\Users\hugok\repositories\repro-astro-svelte\node_modules\.pnpm\[email protected][email protected]\node_modules\react-dom\cjs\react-dom-server.node.production.min.js:72:253)
    at Qc (C:\Users\hugok\repositories\repro-astro-svelte\node_modules\.pnpm\[email protected][email protected]\node_modules\react-dom\cjs\react-dom-server.node.production.min.js:87:219)
    at process.processImmediate (node:internal/timers:478:21)
 ELIFECYCLE  Command failed with exit code 1.

It appears that the function copy_payload is supposed to receive a head object but receives undefined. Without the react integration the build succeeds though so something is clashing between those is my guess.

What's the expected result?

The build should not fail when using bind:value in a svelte component when using it inside a MDX file.

Link to Minimal Reproducible Example

https://github.com/Hugos68/repro-astro-svelte

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 4, 2024
@bluwy bluwy added pkg: svelte Related to Svelte (scope) pkg: react Related to React (scope) pkg: mdx Issues pertaining to `@astrojs/mdx` integration - P3: minor bug An edge case that only affects very specific usage (priority) and removed needs triage Issue needs to be triaged labels Aug 5, 2024
@bluwy bluwy self-assigned this Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) pkg: mdx Issues pertaining to `@astrojs/mdx` integration pkg: react Related to React (scope) pkg: svelte Related to Svelte (scope)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants