Next.js v12
upgrade手順
Rust Compiler
fast refreshが3倍高速に
buildが5倍高速に
Webpackを改善した
Rust Compilerを使うとBabelより17倍高速になった
v12ではdefaultで利用できる
minifyにもRust Compilerが使われる
.babel
が残っていると、SWCではなくBabelが使われる
だから完全にSWCに移行するためには .babel
を消さないといけない
これはalpha版だが、 npm install react@alpha react-dom@alpha
で試せる
Suspenseなどの諸々の機能が使える
getServerSidePropsやgetStaticPropsはもはや不要
page
を .server.js
にするとServer Componentsとみなされる
URL Imports (alpha):
こんな感じでLibraryのimportができる
tsimport confetti from 'https://cdn.skypack.dev/canvas-confetti'
Denoやん

WebPより20%パフォーマンスが良い
Bot-aware ISR Fallback: Optimized SEO for web crawlers
クローラー向けのISR設定ができる
fallback中のページをクローラーがindex作成できなくする
つまり、loadiing...みたいな表示でindexしない
Native ES Modules Support: Aligning with the standardized module system
Webpack5がdefaultになった