next-runtime
next-runtime copied to clipboard
[Bug]: fail build if `output: 'standalone'` config option is set
Summary
Those coming from the docker/k8s world are likely to follow this guidance from Next.js official docs, which instructs them to clone the with-docker
example, whose config explicitly uses output: 'standalone'
:
module.exports = {
output: 'standalone',
}
This will create a folder at .next/standalone which can then be deployed on its own without installing node_modules.
Additionally, a minimal server.js file is also output which can be used instead of next start. This minimal server does not copy the public or .next/static folders by default as these should ideally be handled by a CDN instead, although these folders can be copied to the standalone/public and standalone/.next/static folders manually, after which server.js file will serve these automatically.
As this relies on an always-running node.js server, it's incompatible with our serverless lyfestyle.
@ascorbic suggested that rather than changing the site's next.config.js file at build-time, we fail the build and output an error message:
I think the most useful then would be for us to detect that setting and fail the build, with an appropriate message
Having this error message will be immensely useful for those coming from Next.js wrapped in docker.
Steps to reproduce
- Clone and deploy the
with-docker
example from Next.js examples
A link to a reproduction repository
No response
Next Runtime version
4.28.3
More information about your build
- [ ] I am building using the CLI
- [ ] I am building using file-based configuration (
netlify.toml
)
What OS are you using?
No response
Your netlify.toml file
No response
Your public/_redirects file
No response
Your next.config.js
file
`next.config.js`
module.exports = {
output: 'standalone',
}
Builds logs (or link to your logs)
No response
Function logs
No response
.next JSON files
No response