SWC as the basis of a pure Rust static site generator? #5330
-
For some time now, I've wanted to build a static site generator that's capable of turning various inputs (Markdown, structured data, etc.) into single-page applications (SPAs). So essentially what Next.js does, except using a plain old static binary rather than the usual npm machinery (Node.js + Is it (a) crazy or (b) not crazy to think that SWC's Rust libraries could serve as the basis of such a tool? Intuitively, it seems like it could—if used in conjunction with carefully chosen JS inputs—but I've been reading docs and poking around and I can't quite discern if that intuition is correct. I suspect it probably goes against the grain of SWC, which seems more geared toward being a standalone CLI tool than a library used in other tools, but I would love to know if it's at least theoretically possible to inline things like configuration and JS inputs. Does this seem feasible to others? If so, any places in the Rustdoc that you'd suggest looking? Is anyone else working on something like this? Note: I am aware of Yew and other tools, but I'm not particularly interested in doing this using Wasm. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Honestly in my opinion, no one is probably able to answer this clearly as this is not explicitly explored territory. There are some building blocks SWC naturally able to support some features, but the only way to figure it out is to try. Your best bet is each swc_* package's rust doc for the corresponding feature. But given the complexity of meta framework like next.js does which internalize swc itself, I can easily imagine you have to build a lot of things by yourself. |
Beta Was this translation helpful? Give feedback.
Honestly in my opinion, no one is probably able to answer this clearly as this is not explicitly explored territory. There are some building blocks SWC naturally able to support some features, but the only way to figure it out is to try. Your best bet is each swc_* package's rust doc for the corresponding feature. But given the complexity of meta framework like next.js does which internalize swc itself, I can easily imagine you have to build a lot of things by yourself.