返回博客

为什么我放弃了 Nuxt?

也许是我太菜了。这儿仅记录一下。不做具体评价

年底了,我试着重构博客到 Nuxt,准备体验一下这个框架,但最后我还是放弃了这个框架。

为什么放弃这个框架?

我也为这个问题提了一个 Issues.

Severe performance & memory issues when generating 500+ blog posts

刚开始开发,体验还是很不错的,它对Vue挺友好的,还用的 Vite 这些。

但完成开发,我将我的500多篇文章放进去生成静态站点时,问题就暴露出来了。

先是内存问题,哪怕我把 Node.js 的内存限制调到 8GB 也无济于事。

NODE_OPTIONS="--max-old-space-size=8192" pnpm generate

# 运行一段时间后:
<--- Last few GCs --->
[1234:0x123456789]   123456 ms: Mark-sweep 8192.0 (8234.5) -> 8191.8 (8234.5) MB
[1234:0x123456789]   123789 ms: Mark-sweep 8191.8 (8234.5) -> 8191.7 (8234.5) MB

<--- JS stacktrace --->
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

然后就是这个框架用的 nitro 构建器,生成一篇文章平均要 50 秒,500 篇文章理论上需要 7 个小时。

pnpm generate
# 输出:
# ✓ Generated public/blog/contenteditable in 53680ms
# ✓ Generated public/blog/vue-composition-api in 53682ms
# ✓ Generated public/blog/locale-date-string in 53683ms
# ✓ Generated public/blog/blog-migrate-from-hexo-to-astro in 54071ms

也许是我太菜了。这儿仅记录一下。不做具体评价