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

next.config.js that doesn't export anything doesn't throw error #9919

Closed
timneutkens opened this issue Jan 3, 2020 · 3 comments · Fixed by #10228
Closed

next.config.js that doesn't export anything doesn't throw error #9919

timneutkens opened this issue Jan 3, 2020 · 3 comments · Fixed by #10228
Labels
good first issue Easy to fix issues, good for newcomers
Milestone

Comments

@timneutkens
Copy link
Member

Bug report

Describe the bug

When you have an empty next.config.js no error is thrown, which can cause confusion.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. yarn create next-app --example hello-world
  2. Add next.config.js with contents:
{
  experimental: { basePath: '/docs' }
}
  1. Run yarn dev, everything works but obviously the option isn't applied.

Expected behavior

Next.js should throw an error when there is no object exported from next.config.js.

System information

  • OS: [e.g. macOS, Windows] - macOS, but will happen on both.
  • Version of Next.js: [e.g. 6.0.2] - latest canary

Additional context

Just a small DX improvement.

@dmitrika
Copy link
Contributor

dmitrika commented Jan 22, 2020

Looking at #9921 and at https://nodejs.org/dist/latest-v6.x/docs/api/modules.html#modules_module_require_id looks like we cannot distinguish using require when there is an empty object or nothing is exported.

@timneutkens
Copy link
Member Author

timneutkens commented Jan 22, 2020

@dmitrika yeah unfortunately it's tricky to detects, would improve DX quite a bit though, we got multiple users that didn't export their config.

Potentially we could show a warning along the lines of "Detected next.config.js, no exported configuration found"

@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
good first issue Easy to fix issues, good for newcomers
Projects
None yet
4 participants