This is a Bun 1.0-based variation of the fullstack rendering exampled illustrated in https://vanjs.org/ssr. Compared to the Node.js based implementation illustrated there, here are notable differences:
- 🚀🚀🚀 Everything becomes extremely fast!
- Much cleaner
package.json
, as the Bun runtime can do most of the work. Here are all the dependencies (thedevDependencies
ofbun
is not necessary ifbun
is installed globally. We include it so that the code can be previewed with CodeSandbox):
"dependencies": {
"mini-van-plate": "^0.5.3",
"vanjs-core": "^1.2.6"
},
"devDependencies": {
"bun": "^1.0.0",
"bun-types": "^1.0.1"
}
- No script files (
.sh
files) needed. - The
src/server.ts
file is a few lines shorter than the Node.js based one, primarily thanks to the elimination of external dependencies. - The minified bundle of client
.js
file is slightly larger (3.0kB
vs.2.6kB
). This is because as a new bundler and minifier, Bun has less size optimization options compared to terser.
You can preview the app via CodeSandbox.