kobalte icon indicating copy to clipboard operation
kobalte copied to clipboard

HiddenSelectBase leads to import "use" from "solid-js/web" in compiled SolidStart output

Open JohnCido opened this issue 11 months ago • 5 comments

Describe the bug

I'm currently using SolidUI to add component to my project, since it's a shadcn/ui inspired library and I've located the use function was used by compiled HiddenSelectBase from Kobalte so I do not believe it's an issue of SolidUI.

Inside the compiled output, it has this last line:

import { isServer, createComponent, Dynamic, mergeProps as mergeProps$1, memo, use, spread, insert, effect, style, setAttribute, template, Portal, ssr, ssrHydrationKey } from "solid-js/web";

...

function HiddenSelectBase(props) {
  ...
  return (() =>
    ...
    const _ref$ = mergeRefs((el) => ref = el, local.ref);
    typeof _ref$ === "function" && use(_ref$, _el$4);
...

Which uses a use function imported from solid-js/web, I think the related ref is defined here.

The problem here is that this use function is not exported from solid-js/web at all (SolidJS version 1.9.3) and I'm so confused why it's introduced here in the compiled codes.

To Reproduce Codesanbox URL

Steps to reproduce the behavior:

  1. Add Select or Combobox component using SolidUI
  2. Render it in any route
  3. Set the server preset to be cloudflare-pages inside app.config.ts
  4. Run build script

Expected behavior Build output without error.

Screenshots If applicable, add screenshots to help explain your problem.

截屏2025-01-07 12 57 25

Additional context Please help confirm if this is a Kobalte issue or vinxi issue, since this does not break build process of node-server preset but still adds this use import.

JohnCido avatar Jan 07 '25 05:01 JohnCido

I had the same issue; updating to vinxi v0.5.3 solved this issue for me.

AlexErrant avatar Mar 04 '25 23:03 AlexErrant

Any updates on this? I am still experiencing this issue with the latest version. Even clientOnly is not a cure here. The app is functioning fine, though. Also, I see this error only in the server terminal. Thank you for your awesome library!

import { use, spread, mergeProps, insert, createComponent, effect, style, setAttribute, template } from 'solid-js/web';
         ^^^
SyntaxError: The requested module 'solid-js/web' does not provide an export named 'use'

rwxae avatar Apr 19 '25 21:04 rwxae

Most likely the problem is in the build process.

For some reason, bundler converts the following lines:

<select
    ref={mergeRefs((el) => (ref = el), local.ref)}
    ...

To this:

import { use, ... } from 'solid-js/web';
...
const _ref$ = mergeRefs((el) => ref = el, local.ref);
typeof _ref$ === "function" && use(_ref$, _el$4);

rwxae avatar Apr 19 '25 21:04 rwxae

I have the same issue:

Image

NorbertSandor avatar Jul 05 '25 09:07 NorbertSandor

Can yall confirm what version of Vinxi, Solid, Solid Start, and Kobalte you're on. Minimal repro would also be nice.

I'll note that John's repro uses "vinxi": "^0.4.3" which I believe is the problem.

AlexErrant avatar Jul 05 '25 17:07 AlexErrant