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

Closed
uhrohraggy opened this issue Sep 17, 2024 · 3 comments · Fixed by #70376
Closed

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

uhrohraggy opened this issue Sep 17, 2024 · 3 comments · Fixed by #70376
Labels
Documentation Related to Next.js' official documentation. locked

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.

samcx added a commit that referenced this issue Sep 24, 2024
…supported yet) (#70376)

## Why?

We should update our documentation and also throw an error if somebody
tries to use the `.mts` ( ES Module TypeScript) extension with
`next.config`. We currently don't support this extension.

- Fixes: #70201

---------

Co-authored-by: JJ Kasper <[email protected]>
Copy link
Contributor

github-actions bot commented Oct 9, 2024

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot added the locked label Oct 9, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Documentation Related to Next.js' official documentation. locked
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants