Which directories can i remove after building with next build
Answered
Saltwater Crocodile posted this in #help-forum
Saltwater CrocodileOP
i have built with
& does the standalone output come with any downsides?
next build, can i remove node_modules, or source code and just keep the .vercel directory?/** @type {import('next').NextConfig} */
const nextConfig = {};
export default nextConfig;& does the standalone output come with any downsides?
Answered by joulev
if you want to deploy somewhere and not have the whole node_modules in there, you need to deploy using the standalone output (so you'll need to edit that config file).
in standalone output, the content of the output folder is all that is necessary. so you just need to copy it. no need of any other files, not even the project's
in standalone output, the content of the output folder is all that is necessary. so you just need to copy it. no need of any other files, not even the project's
node_modules since the output folder should have its own node_modules with only the required dependencies.10 Replies
can i remove node_modules, or source code and just keep the .vercel directory?For what? You can delete everything. But if you want to deploy it than, then you can't delete it. So, why you want to delete them and what do you want to do afterwards with it?
@B33fb0n3 > can i remove node_modules, or source code and just keep the .vercel directory?
For what? You can delete everything. But if you want to deploy it than, then you can't delete it. So, why you want to delete them and what do you want to do afterwards with it?
Saltwater CrocodileOP
making a docker container, and i dont want to have unnecessary things there
@Saltwater Crocodile making a docker container, and i dont want to have unnecessary things there
nextjs builds only needed things iirc. So don't delete anything. After you build your project by doing
docker build -t nextjs-docker you can run it with docker run -p 3000:3000 nextjs-docker. Leave everything as it is.@Saltwater Crocodile i have built with `next build`, can i remove node_modules, or source code and just keep the .vercel directory?
/** @type {import('next').NextConfig} */
const nextConfig = {};
export default nextConfig;
& does the standalone output come with any downsides?
if you want to deploy somewhere and not have the whole node_modules in there, you need to deploy using the standalone output (so you'll need to edit that config file).
in standalone output, the content of the output folder is all that is necessary. so you just need to copy it. no need of any other files, not even the project's
in standalone output, the content of the output folder is all that is necessary. so you just need to copy it. no need of any other files, not even the project's
node_modules since the output folder should have its own node_modules with only the required dependencies.Answer
@joulev if you want to deploy somewhere *and* not have the whole node_modules in there, you need to deploy using the standalone output (so you'll need to edit that config file).
in standalone output, the content of the output folder is all that is necessary. so you just need to copy it. no need of any other files, not even the project's `node_modules` since the output folder should have its own `node_modules` with only the required dependencies.
Saltwater CrocodileOP
Is there any downsides to it
nope. standalone build supports all features of nextjs
@joulev nope. standalone build supports all features of nextjs
Saltwater CrocodileOP
where is the output built though
@Saltwater Crocodile where is the output built though
.next/standalone
Saltwater CrocodileOP
i see