[{"data":1,"prerenderedAt":100},["ShallowReactive",2],{"blog-en-nextjs-12-middleware":3},{"id":4,"title":5,"body":6,"cover":84,"date":85,"description":86,"draft":87,"extension":88,"locale":89,"meta":90,"navigation":91,"path":92,"seo":93,"stem":94,"tags":95,"__hash__":99},"blog\u002Fblog\u002Fen\u002Fnextjs-12-middleware.md","Next.js 12: faster, thanks to Rust",{"type":7,"value":8,"toc":78},"minimark",[9,13,18,21,27,30,34,47,50,72,75],[10,11,12],"p",{},"Some updates change features, others change how the work feels. Next.js 12 belongs firmly to\nthe second kind for me. The leap isn't a new button — it's under the hood, exactly where you sit\nwaiting as a developer every single day.",[14,15,17],"h2",{"id":16},"rust-instead-of-babel","Rust instead of Babel",[10,19,20],{},"The centerpiece is the move from Babel and Terser to SWC, a compiler written in Rust. It sounds\nlike plumbing, but it's tangible: builds and hot reloads run noticeably faster, because\ntranspiling and minifying no longer have to crawl through JavaScript-based tooling at the old\npace.",[22,23,24],"blockquote",{},[10,25,26],{},"Speed while building isn't a luxury. It's the difference between staying in flow and waiting.",[10,28,29],{},"For my work that means one thing above all: tighter loops. Saving a change and seeing the result\nalmost instantly keeps the creative tension alive. The less I wait on the tooling, the more\nattention is left for the actual design.",[14,31,33],{"id":32},"middleware-logic-at-the-edge","Middleware: logic at the edge",[10,35,36,37,41,42,46],{},"The second big addition is Middleware. It lets me run code ",[38,39,40],"strong",{},"before"," a request finishes — at the\nedge, close to the user. One file, one ",[43,44,45],"code",{},"middleware"," function, and I can redirect, rewrite, set\nheaders, or steer requests depending on context.",[10,48,49],{},"That unlocks things that used to be awkward:",[51,52,53,60,66],"ul",{},[54,55,56,59],"li",{},[38,57,58],{},"Localization"," by region or language, before the page even renders",[54,61,62,65],{},[38,63,64],{},"A\u002FB tests"," and feature flags without the flicker",[54,67,68,71],{},[38,69,70],{},"Auth checks"," early in the lifecycle, instead of patching it in the client",[10,73,74],{},"The right measure still matters: middleware runs on every matching request, so only what truly\nneeds to be lean and decided early belongs there. Heavy logic stays elsewhere.",[10,76,77],{},"Together, SWC and Middleware paint a coherent picture: Next.js 12 makes development faster and\ndelivery smarter. It's precisely that pairing of speed and control that makes the platform feel\nright to me.",{"title":79,"searchDepth":80,"depth":80,"links":81},"",2,[82,83],{"id":16,"depth":80,"text":17},{"id":32,"depth":80,"text":33},null,"2021-10-26","Next.js 12 brings the SWC compiler and Middleware — how it speeds up my builds and moves logic closer to the edge.",false,"md","en",{},true,"\u002Fblog\u002Fen\u002Fnextjs-12-middleware",{"title":5,"description":86},"blog\u002Fen\u002Fnextjs-12-middleware",[96,97,98],"Next.js","Performance","Web","iPplILTArfGAXnggc8rrUCC1XrHkQG9ch5dn-5Uft0g",1781691288027]