-
Notifications
You must be signed in to change notification settings - Fork 27.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom server config not working #60040
Comments
You need to also add /** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
distDir: '.custom_dist',
}
module.exports = nextConfig |
@Bahlaouane-Hamza thanks for the suggestion. But the bug still persists. The Next JS documentation provides the option for a In addition, there are scenarios where the |
Here's what happens as far as I understand:
next.js/packages/next/src/server/next.ts Line 71 in c1f8d93
But does not pass it through to the router server. So it's not used eventually. next.js/packages/next/src/server/next.ts Line 274 in c1f8d93
The router server calls https://github.com/vercel/next.js/blob/c1f8d93/packages/next/src/server/lib/router-server.ts#L82 So next.js/packages/next/src/server/config.ts Line 865 in c1f8d93
So currently, the passed config is not used and next.config.js is currently only the source of truth. |
Link to the code that reproduces this issue
https://codesandbox.io/p/devbox/next-js-custom-server-bug-6z8fhc
To Reproduce
npx create-next-app@latest
.cd
into the new directory and add a basicserver.js
file in the root directory with these content:node server.js
to start the development server.Current vs. Expected behavior
Expectation
When the development server is started, the dist directory should be loaded from the
conf
property in thenext
function argument, and there should be a new folder in the root directory named.custom_dist
.Current Behavior
The default
.next
directory is used instead of the specified.custom_dist
directory.Verify canary release
Provide environment information
Operating System: Platform: linux Arch: x64 Version: #1 SMP PREEMPT_DYNAMIC Sun Aug 6 20:05:33 UTC 2023 Binaries: Node: 20.9.0 npm: 9.8.1 Yarn: 1.22.19 pnpm: 8.10.2 Relevant Packages: next: 14.0.4 eslint-config-next: 14.0.4 react: 18.2.0 react-dom: 18.2.0 typescript: 5.3.3 Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
Not sure
Additional context
This bug appeared with Next 13. I'm currently running Next 12 on my apps to avoid this bug.
The text was updated successfully, but these errors were encountered: