最近Next.js 12发布了,据说编译速度提高17倍,刷新速度5倍。体验一下。看了一下博客代码package.json,Next.js版本竟然是10。。
yarn add react@latest react-dom@latest
yarn add next@11
跑一下dev
Error: `future.webpack5` in `next.config.js` has moved to the top level `webpack5` flag https://nextjs.org/docs/messages/future-webpack5-moved-to-webpack5
at Object.loadWebpackHook (K:\miantu_net\notion-blog\node_modules\next\dist\server\config-utils.js:94:15)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async Object.loadConfig [as default] (K:\miantu_net\notion-blog\node_modules\next\dist\server\config.js:332:5)
at async NextServer.loadConfig (K:\miantu_net\notion-blog\node_modules\next\dist\server\next.js:112:22)
at async NextServer.prepare (K:\miantu_net\notion-blog\node_modules\next\dist\server\next.js:94:24)
at async K:\miantu_net\notion-blog\node_modules\next\dist\cli\next-dev.js:121:9
error Command failed with exit code 1.
next.config.js以前开了webpack5,但是12已经改用swc,直接删掉。
yarn add next@12
享受开始了
yarn run v1.22.15
$ next dev
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info - Loaded env from K:\miantu_net\notion-blog\.env.local
info - Loaded env from K:\miantu_net\notion-blog\.env
warn - Minimum recommended TypeScript version is v4.3.2, older versions can potentially be incompatible with Next.js. Detected: 4.2.2
event - compiled successfully in 4.4s (240 modules)
wait - compiling /_error...
event - compiled successfully in 187 ms (241 modules)
wait - compiling /blog (client only)...
event - compiled successfully in 473 ms (256 modules)
虽然多了个编译时间,但是以前的编译时间看不到了啊喂。。
emmm,因为notion api的调用有速度限制。。哎依然慢。。。
swc在alpine的docker镜像中没法构建,替换成bullseye的就好了。