errors/now-next-legacy-mode.md
@vercel/next Legacy Mode@vercel/next has two modes: legacy and serverless. You will always want to use the serverless mode. legacy is to provide backwards compatibility with previous @vercel/next versions.
The differences:
Legacy:
2.2Mb (approximately)[email protected] and [email protected]dependencies to be devDependenciesnext.config.js on bootup, breaking sometimes when users didn't use phases to load filesnext-server which is the full Next.js server with routing etc.npm installnpm run now-buildnpm install --production after buildServerless:
49Kb (approximately)target: 'serverless') in next.config.js. documentationnext.config.js (as per the serverless target documentation)npm installnpm run now-buildnpm install --production as the output from the build is all that's needed to bundle lambdas.In order to create the smallest possible lambdas Next.js has to be configured to build for the serverless target.
latest version:npm install next --save
now-build script to your package.json{
"scripts": {
"now-build": "next build"
}
}
target: 'serverless' to next.config.jsmodule.exports = {
target: 'serverless',
// Other options are still valid
};
"src" in "builds" points to your application package.json{
"version": 2,
"builds": [{ "src": "package.json", "use": "@vercel/next" }]
}