Skip to content
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

Docs: Next Config Support For (Or Note not Supporting) next.config.mts #70201

Open
uhrohraggy opened this issue Sep 17, 2024 · 2 comments
Open
Labels
Documentation Related to Next.js' official documentation.

Comments

@uhrohraggy
Copy link

uhrohraggy commented Sep 17, 2024

What is the documentation issue?

https://nextjs.org/docs/pages/api-reference/next-config-js mentions the next.config.mjs extension as well as using the TypeScript next.config.ts. I know this is likely PEBKAC, but with the Next.js 14 default being next.config.mjs, I assumed that I could be explicit and change this to next.config.mts.

However, running next build actually ignores this file without complaints and assumes the defaults as if this file doesn't exist. For example, setting this in next.config.mts

  distDir: 'standalone-build',
  output: 'standalone',

is ignored and the build is created in the .next directory.

Is there any context that might help us understand?

I'm not sure of the proper solution, but one of

  1. Provide a footnote that next.config.mts isn't supported and will be ignored
  2. If next.config.mts support is planned for, provide a note in the documentation.
  3. If next.config.mts support was expected to work, turn this documentation issue into a bug.
  4. Check for next.config.mts and provide a build log if found on how to resolve

Does the docs page already exist? Please link to it.

https://nextjs.org/docs/pages/api-reference/next-config-js

@uhrohraggy uhrohraggy added the Documentation Related to Next.js' official documentation. label Sep 17, 2024
@karlhorky
Copy link
Contributor

Potentially related:

@samcx
Copy link
Member

samcx commented Sep 19, 2024

@uhrohraggy We should go with #1 and #4.

 ✓ Starting...
 ⚠ Configuration with next.config.ts is currently an experimental feature, use with caution.
 ✓ Ready in 540ms

We could have a similar warning when we see a next.config.mts file, stating that the config file will be ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Related to Next.js' official documentation.
Projects
None yet
Development

No branches or pull requests

3 participants