惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
PCI Perspectives
PCI Perspectives
The Hacker News
The Hacker News
Project Zero
Project Zero
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
P
Privacy International News Feed
C
Cybersecurity and Infrastructure Security Agency CISA
Schneier on Security
Schneier on Security
V
Vulnerabilities – Threatpost
T
Threat Research - Cisco Blogs
Blog — PlanetScale
Blog — PlanetScale
Hugging Face - Blog
Hugging Face - Blog
博客园_首页
C
Cisco Blogs
C
CERT Recently Published Vulnerability Notes
L
Lohrmann on Cybersecurity
Cisco Talos Blog
Cisco Talos Blog
WordPress大学
WordPress大学
Cloudbric
Cloudbric
Know Your Adversary
Know Your Adversary
博客园 - Franky
博客园 - 聂微东
S
SegmentFault 最新的问题
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
AI
AI
Latest news
Latest news
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Vercel News
Vercel News
H
Heimdal Security Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Spread Privacy
Spread Privacy
IT之家
IT之家
N
News and Events Feed by Topic
H
Hacker News: Front Page
The Cloudflare Blog
Jina AI
Jina AI
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Webroot Blog
Webroot Blog
I
Intezer
L
LangChain Blog
T
The Blog of Author Tim Ferriss
T
Threatpost
A
About on SuperTechFans
博客园 - 叶小钗
美团技术团队
NISL@THU
NISL@THU
H
Hackread – Cybersecurity News, Data Breaches, AI and More
www.infosecurity-magazine.com
www.infosecurity-magazine.com

Vercel News

Vercel Open Source Program: Winter 2026 cohort How Notion Workers run untrusted code at scale with Vercel Sandbox How we run Vercel's CDN in front of Discourse From idea to secure checkout in minutes with Stripe Building Slack agents can be easy Scaling redirects to infinity on Vercel Advancing Python typing Gamma builds design-first agents with Vercel How Avalara turns pipe dreams into patent-pending with v0 Keeping community human while scaling with agents How OpenEvidence built a healthcare AI that physicians actually trust Security boundaries in agentic architectures Skills Night: 69,000+ ways agents are getting smarter Video Generation with AI Gateway We Ralph Wiggumed WebStreams to make them 10x faster How Stably ships AI testing agents in hours, not weeks How we built AEO tracking for coding agents Anyone can build agents, but it takes a platform to run them Introducing Geist Pixel The Vercel AI Accelerator is back with $6m in credits Making agent-friendly pages with content negotiation The Vercel OSS Bug Bounty program is now available Introducing the new v0 Run untrusted code with Vercel Sandbox, now generally available How Stripe built a game-changing app in a single flight with v0 How Sensay went from zero to product in six weeks AGENTS.md outperforms skills in our agent evals Agent skills explained: An FAQ Testing if "bash is all you need" AWS databases are now live on the Vercel Marketplace and v0 Use Perplexity Web Search with Vercel AI Gateway Introducing: React Best Practices Nick Bogaty joins Vercel as Chief Revenue Officer How Mux shipped durable video workflows with their @mux/ai SDK How to build agents with filesystems and bash How we made v0 an effective coding agent Stopping the slow death of internal tools Building AI-Generated Pixel Trading Cards with Vercel AI Gateway We removed 80% of our agent’s tools AI SDK 6 Our $1 million hacker challenge for React2Shell Cline now runs on Vercel AI Gateway How to prompt v0 Build smarter workflows with Notion and v0 Vercel launches partner certification Inside Workflow DevKit: How framework integrations work React2Shell Security Bulletin | Vercel Knowledge Base Billions of requests: Black Friday-Cyber Monday 2025 Investing in the Python ecosystem AWS Databases coming to the Vercel Marketplace How we built the v0 iOS app Workflow Builder: Build your own workflow automation platform Vercel Open Source Program: Fall 2025 cohort Self-driving infrastructure Vercel collaborates with Google for Gemini 3 Pro Preview launch Vercel: The anti-vendor-lock-in cloud How Nous Research used BotID to block automated abuse at scale How AI Gateway runs on Fluid compute What we learned building agents at Vercel Build and deploy data applications on Snowflake with v0 BotID Deep Analysis catches a sophisticated bot network in real-time Vercel achieves TISAX AL2 compliance to serve automotive partners Bun runtime on Vercel Functions David Totten Joins Vercel to Lead Global Field Engineering Vercel Ship AI 2025 recap You can just ship agents AI agents and services on the Vercel Marketplace Built-in durability: Introducing Workflow Development Kit Zero-config backends on Vercel AI Cloud Introducing Vercel Agent: Your new Vercel teammate Update regarding Vercel service disruption on October 20, 2025 Agents at work, a partnership with Salesforce and Slack Running Next.js in ChatGPT: How to Build ChatGPT Apps Talha Tariq joins Vercel as CTO of Security Just another (Black) Friday Server rendering benchmarks: Fluid Compute and Cloudflare Workers Towards the AI Cloud: Our Series F Collaborating with Anthropic on Claude Sonnet 4.5 to power intelligent coding agents Preventing the stampede: Request collapsing in the Vercel CDN BotID uncovers hidden SEO poisoning How we made global routing faster with Bloom filters What you need to know about vibe coding Scale to one: How Fluid solves cold starts Addressing security & quality issues with MCP tools - Vercel AI agents at scale: Rox’s Vercel-powered revenue operating system Agentic Infrastructure Zero Data Retention on AI Gateway Optimizing Vercel Sandbox snapshots How Waldium made a blog platform work for humans and AI alike How FLORA shipped a creative agent on Vercel's AI stack Agent responsibly Making Turborepo 96% faster with agents, sandboxes, and humans Unified reporting for all AI Gateway usage new.website joins forces with v0 SERHANT.'s playbook for rapid AI iteration Two startups at global scale without DevOps Chat SDK brings agents to your users 360 billion tokens, 3 million customers, 6 engineers Meet the 2026 Vercel AI Accelerator Cohort Build knowledge agents without embeddings
10 Next.js tips you might not know - Vercel – Vercel
2021-01-26 · via Vercel News

5 min read

Techniques from the Next.js experts that empower your application.

Here are 10 little known Next.js tips you might not have heard that could help you save time on your next project:

Link to headingTip 1: Next.js Redirects

Next.js Redirects are new to version 9.5 (released in July 2020) and give the ability to reroute an incoming request path to another destination. 

Path matching, regex path matching, and wildcard paths are all valid ways to reroute your source path. Use the redirects key to create an asynchronous function that will return an array of objects where each object contains the properties for a redirect in the application. 

next.config.js

module.exports = {

async redirects() {

return [

{

source: '/about',

destination: '/',

permanent: true,

},

]

},

}

For more usage examples, take a look at this next.config.js file.

Link to headingTip 2: Next.js Rewrites

Rewrites were also introduced in Next.js 9.5 and work similar to redirects. Where a redirect will reroute a page with a 301/302 status code, a rewrite will act as a proxy and mask the new path. This will make it appear to the user that they have not changed where they are on the site. 

The same rules apply for rewrites as they do for redirects except that rewrites are not able to overwrite public files or the routes that are automatically generated from the pages folder. These routes take precedence over rewrites.

next.config.js

module.exports = {

async rewrites() {

return [

{

source: '/about',

destination: '/',

},

]

},

}

To take a look at how rewrites look using regex or wildcard paths, take a look at this next.config.js file. 

Link to headingTip 3: Next.js Preview Mode

Preview Mode allows you to see a draft of your statically-generated content prior to publishing it to the web. Next.js has the ability to generate these draft pages at request time instead of build time so that developers can see what their content will look like when published. 

Take a look at the Next.js Preview Mode documentation for detailed information on how to build this out or test out Preview Mode before constructing it on your own with this example Vercel application

Link to headingTip 4: Hooking into the Build Process

With Next.js, we can use the next.config.js file to override defaults, configure Webpack, or inject code into the build process. By running a script during the build process to inject code, Next.js can create a sitemap, RSS feed, or a search index with ease.

Link to headingTip 5: Next.js With Preact

If you’re building a basic Next.js application and not using advanced React functionality, you can explore using Preact with Next.js. For more information about Preact, check our their documentation.

You can use Preact only in the client production build so you don’t miss any features of the Next.js local development experience. Use next.config.js to override the default Webpack configuration and use Preact.

New features in React may not be compatible with Preact (i.e. Suspense or Server Components) .

next.config.js

module.exports = {

webpack: (config, { dev }) => {

// Replace React with Preact only in client production build

if (!dev) {

Object.assign(config.resolve.alias, {

react: 'preact/compat',

'react-dom/test-utils': 'preact/test-utils',

'react-dom': 'preact/compat'

});

}

return config;

}

};

Link to headingTip 6: Absolute Imports and Module Path Aliases

As your application grows, you might end up with deeply nested import statements. To prevent the import statements’ relative paths from becoming excessive, you can use Absolute Imports and Module Path Aliases to make them more readable.

This, for example, will turn:

import Button from../../../components/button”;

to:

import Button from “@/components/button”;

It creates a much shorter string that is easier to read. Now instead of being an import with a relative path, it is an absolute import. 

To set this up, create a JSON file. Inside this file, create a compilerOptions object inside a JSON object that will contain a baseUrl that is a string and paths property that is an object. 

Your configuration file for absolute imports should look something like this:

{

  "compilerOptions": {

    "baseUrl": ".",

    "paths": {

      "@/components/*": ["components/*"]

    }

  }

}

The baseUrl property indicates that the base of the absolute import starts in the same directory that the configuration file is in. The paths object sets up the string we will use for the module alias as the key.

The value is an array that contains the relative path to the folder we are wanting to make the alias. The asterisk on the end of the key and value mean that any file or directory in the components folder can follow the same convention.

This structure is not necessary to create your project, but is a great way to make your import statements a little easier to read.

Link to headingTip 7: CRUD API Routes

CRUD stands for Create, Read, Update, and Delete — all are common HTTP methods used in an application programming interface (API) that POST, GET, PUT, and DELETE data. 

We have the ability to build basic CRUD endpoints using the built-in Next.js router. Create a folder inside pages called api. Inside api create a file with a .js or .ts extension that will contain the handler for all of our CRUD methods. 

Here’s a high-level outline of how an API might look: 

pages/api/item.js

export default async function handler(req, res) {

if (req.method === 'PUT') {

res.status(201).json({});

}

if (req.method === 'GET') {

res.status(200).json({});

}

if (req.method === 'POST') {

res.status(200).json({});

}

if (req.method === 'DELETE') {

res.status(204).json({});

}

}

The actual setup used to define these endpoints may vary depending on how the app is constructed.

Link to headingTip 8: Setting Response HTTP Caching Headers

For static pages, the Vercel Edge Network will automatically cache static assets in order to serve data as fast as possible. When there is a need to use an API Route or Server-Side Rendered page, though, you will need to set a Cache-Control header. 

Here’s an example API Route that sends a JSON response and caches that response for one day: 

pages/api/user.js

export default function handler(req, res){

  res.setHeader(

    'Cache-Control',

    's-maxage=86400'

  );

  res.status(200).json({name: ‘John Doe’ });

};

Link to headingTip 9: Shared Component Attributes

When working with Next.js applications, sometimes there is a need to share information between pages. This is done by creating a _app.js file in the pages folder. 

pages/index.js

Home.title = "test"

Home.description = "A container for blog posts"

export default function Home() {

return (

<Container>

<Blogpost />

</Container>

)

}

pages/_app.js

import Head from 'next/head'

export default function App({ Component, pageProps }) {

return (

<>

<Head>

<title>{Component.title}</title>

<meta name="description" content={Component.description} />

</Head>

<Component {...pageProps} />

</>

)

}

This is just one way to take advantage of the customized app. There are several different things a developer can do when creating a custom app including global CSS, shared layout, maintain state, and more.  

Link to headingTip 10: Next.js Mobile Applications? 

You can create a mobile app with Next.js? How is that possible!? 

Thanks to the Ionic team, you can build mobile-like experiences using Next.js. They are the creator of CapacitorJS, a library that will give you a native-like experience on your mobile phone.

The Mobile Stack Visualized

The Mobile Stack Visualized

Learn more about Ionic's Next.js/Tailwind CSS/Capacitor starter here.

Link to headingNext Steps

That’s it! How many of these tips are you going to implement in your next project?

If you have never used Next.js before, start with this tutorial on creating your Next.js application

If you have never written any React code before, start with React’s official tutorial. This will help you get a firm grasp on JavaScript and React prior to using Next.js. 

For the easiest way to deploy a Next.js app, start with this introduction to Vercel. Vercel, built by the same team that made Next.js, provides production-grade hosting for Next.js websites with zero configuration.