vite-plugin-use-golang

Dev tools

vite plugin

SHOW HN2025

158points
47comments
#452of 3,837 in 2025
Top 12%of 2025 by points

How HN took it

DebatedReal support and real criticism

6 positive, 7 neutral or asking, 1 mixed, 10 critical, out of 24 comments about the project. Thread score -0.07.

Idea: 4 for, 4 againstPerformance: 0 for, 4 againstDesign: 0 for, 2 againstExecution: 1 for, 0 againstDocs: 1 for, 0 against

The thread, comment by comment

Each row is a top-level comment and its replies, in HN's order. Select a cell to open that comment on HN.

positive neutral or mixed critical about another commenter or something else the maker

What HN said

What people liked

  • Fun and clever hack; good docs on when to use it

    From 3 comments
    • Like it. Especially the how to use it and when to use it guidance.
      hshdhdhehd on HN
    • Unironically a really cool use of wasm. Might use this on my personal site lmao
      chamomeal on HN
    • funny but this is going to become extremely popular.
      smashah on HN

Objections

  • Writing Go inside .js files is unidiomatic; importing .go files is preferred

    From 3 comments
    • Beautiful. Minor feedback: rather than having a "use golang" directive, just allow imports of .go files. This is more idiomatic for JS bundlers.
      tkzed49 on HN
    • Definitely not a minor feedback, there's no reason to write go in a .js file. Vite/rollup are perfectly able to "load" certain file types and parse them however you like.
      halapro on HN
    • That would also avoid the problem with this syntax, that it's not a valid Go file (it doesn't start with `package ...` and I don't think a bare top-level string is valid), which…
      CamouflagedKiwi on HN
  • Browser WASM rarely beats JavaScript or WebGPU for performance

    From 4 comments
    • Cool hack, just use JavaScript.
      pjmlp on HN
    • WebGPU or WebGL is the answer.
      pjmlp on HN
    • Better performance? For javascript code that calls into native platform apis provided by the browser it's been alteady proven that performance is an order of magnitude better…
      hollowturtle on HN
    • I was playing around with WASM and WebGL a few years ago to see if it could be used to increase JS performance on certain computationally heavy tasks. I might be misremembering…
      kypro on HN
  • Backend-style code in the frontend risks business logic leaking to the client

    From 1 comment
    • Just be careful with this backend-code-in-frontend stuff. If it's needed for some computationally expensive logic that is logically client side, then fine. But be wary of letting…
      liampulles on HN

Requests

  • Allow importing .go files instead of the use golang directive

    From 2 comments
    • Beautiful. Minor feedback: rather than having a "use golang" directive, just allow imports of .go files. This is more idiomatic for JS bundlers.
      tkzed49 on HN
    • I would rather instantiate wasm module myself and have a build step to compile .go file. This way both JS and Go tooling would work.
      ivanjermakov on HN
  • Support for Julia or scientific computing use cases

    From 1 comment
    • > Scientific computing where you already have Go code This is a really cool project and I must admit that and I am on the side as well also asking for something similar to your…
      Imustaskforhelp on HN

Questions

  • How big is the WASM bundle compared to imagemagick wasm?

    From 1 comment
  • Does it run only on the backend?

    From 1 comment
    • I'm guessing this only works on back end? If yes, then why not just write the back end in Go if you're so fond of the language? It's not like Golang lacks the libraries to do web…
      lisbbb on HN

Alternatives named

  • Importing .go files via tinygo WASM builds

    From 1 comment
    • Looks interesting and good use case for introducing folks to extending web apps with WASM functionality. Used a similar technique using tinygo wasm builds (without Vite ofcourse)…
      zikani_03 on HN
  • Browser WebGPU or WebGL for compute

    From 2 comments
    • WebGPU or WebGL is the answer.
      pjmlp on HN
    • You can take advantage of that power via WebGPU, or WebGL if the browser is not yet up to it.
      pjmlp on HN
  • polyglot-tag

    From 1 comment
    • Reminds me of this toy I made some years ago: https://www.npmjs.com/package/polyglot-tag
      foreigner on HN

Category, keywords, summaries and labels on this page were made by AI (Thread Reader v2) and not checked by hand. Each point links to the comments it came from.

Add a badge to your READMEShown on HackerShow
[![Shown on HackerShow](https://hackershow.org/badge.svg)](https://hackershow.org/show/45717724)