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

Bun SSR failed to import "/__vue-jsx-ssr-register-helper" #376

Closed
8 of 9 tasks
luckydye opened this issue Mar 21, 2024 · 0 comments · Fixed by #380
Closed
8 of 9 tasks

Bun SSR failed to import "/__vue-jsx-ssr-register-helper" #376

luckydye opened this issue Mar 21, 2024 · 0 comments · Fixed by #380
Labels
feat: ssr p2-nice-to-have 🍰 Not breaking anything but nice to have (priority)

Comments

@luckydye
Copy link
Contributor

luckydye commented Mar 21, 2024

Related plugins

Describe the bug

The Bun implementation of Function.toString differs from node, as described in oven-sh/bun#9543.
This causes the serialization of ssrRegisterHelper to output a incorrect string.

I'm suggesting this change:

const ssrRegisterHelperCode =
  `import { useSSRContext } from "vue"\n` +
  `export const ssrRegisterHelper = ${ssrRegisterHelper.toString()}`;

Adding a const ssrRegisterHelper = in front of the function to make sure it gets the name for export.

Reproduction

https://github.com/luckydye/bun-ssr-vue-jsx

Steps to reproduce

  • bun install
  • bun --bun run dev

System Info

System:
    OS: macOS 14.2.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 163.16 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 21.6.1 - ~/.local/share/mise/installs/node/latest/bin/node
    npm: 10.2.4 - ~/.local/share/mise/installs/node/latest/bin/npm
    bun: 1.0.33 - ~/.local/share/mise/installs/bun/latest/bin/bun
  npmPackages:
    @vitejs/plugin-vue: ^4.5.2 => 4.6.2
    @vitejs/plugin-vue-jsx: ^3.1.0 => 3.1.0
    vite: ^5.0.10 => 5.2.2

Used Package Manager

bun

Logs

Click to expand!
2:46:16 PM [vite] Error when evaluating SSR module /src/components/HelloWorld.jsx: failed to import "/__vue-jsx-ssr-register-helper"
|- Error: Expected ident
    at getRollupError (/Users/tihav/source/nuxt-bun/bun-ssr-vue-jsx/node_modules/rollup/dist/es/shared/parseAst.js:377:15)
    at convertProgram (/Users/tihav/source/nuxt-bun/bun-ssr-vue-jsx/node_modules/rollup/dist/es/shared/parseAst.js:1042:19)
    at processTicksAndRejections (:13:78)

Validations

@edison1105 edison1105 added feat: ssr p2-nice-to-have 🍰 Not breaking anything but nice to have (priority) and removed pending triage labels Sep 18, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Nov 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feat: ssr p2-nice-to-have 🍰 Not breaking anything but nice to have (priority)
Projects
None yet
2 participants