solid-labels icon indicating copy to clipboard operation
solid-labels copied to clipboard

Bun plugin

Open Atulin opened this issue 10 months ago • 3 comments

I could be missing some non-obvious way to handle that, but from what I can tell none of the provided plugins works with the Bun bundler. Would be nice to have a version that does.

Atulin avatar Jun 27 '25 12:06 Atulin

Current solution: I added the ability to pass Babel options to my @atulin/bun-plugin-solid fork. The code below works just fine:

import { SolidPlugin } from "@atulin/bun-plugin-solid";
import solidLabels from "solid-labels/babel";

await Bun.build({
  entrypoints: "./src",
  outdir: "./dist",
  plugins: [
    SolidPlugin({
      babelOptions: {
        plugins: [[solidLabels, {}]],
      },
    }),
  ],
});

Atulin avatar Jun 27 '25 19:06 Atulin

Yeah currently solid-labels only supports what unplugin supports

lxsmnsyc avatar Jun 28 '25 04:06 lxsmnsyc

Found an issue with this approach: the only way I could get types supported in Rider, was by creating a types/solid-ext.d.ts file with import "solid-labels"; in it. That makes all $signal() and other transpiled functions recognized and work correctly.

Alas, it makes the re-exported stuff not work. For example $resource() doesn't get imported into the resulting file. Neither do the Solid components like <Show>. The IDE treats them as if they were being autoimported and so it shows no errors on usage, and it doesn't add them to the import {} from 'solid-js' list.

After compilation, though, the browser throws a _Show is not defined error in the console, so something is amiss.

Atulin avatar Jul 25 '25 09:07 Atulin