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

fix: 9919 Add warning when no config is exported from next.config.js #10228

Merged
merged 7 commits into from Jan 29, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 19 additions & 0 deletions errors/empty-configuration.md
@@ -0,0 +1,19 @@
# Detected next.config.js, no exported configuration found

#### Why This Warning Occurred

There is no object exported from next.config.js or the object is empty.

#### Possible Ways to Fix It

Check if you export correctly configuration in next.config.js file:
dmitrika marked this conversation as resolved.
Show resolved Hide resolved

```
module.exports = {
/* config options here */
}
```

### Useful Links

- [Introduction to next.config.js](https://nextjs.org/docs/api-reference/next.config.js/introduction)
2 changes: 1 addition & 1 deletion packages/next/next-server/server/config.ts
Expand Up @@ -232,7 +232,7 @@ export default function loadConfig(
if (Object.keys(userConfig).length === 0) {
console.warn(
chalk.yellow.bold('Warning: ') +
timneutkens marked this conversation as resolved.
Show resolved Hide resolved
'Detected next.config.js, no exported configuration found.'
'Detected next.config.js, no exported configuration found. https://err.sh/zeit/next.js/empty-configuration'
)
}

Expand Down
4 changes: 2 additions & 2 deletions test/integration/config-empty/test/index.test.js
Expand Up @@ -21,7 +21,7 @@ describe('Empty configuration', () => {
})
expect(stdout).toMatch(/Compiled successfully./)
expect(stderr).toMatch(
/Warning: Detected next.config.js, no exported configuration found./
/Warning: Detected next.config.js, no exported configuration found. https:\/\/err.sh\/zeit\/next.js\/empty-configuration/
)
})

Expand All @@ -38,7 +38,7 @@ describe('Empty configuration', () => {
await killApp(app)

expect(stderr).toMatch(
/Warning: Detected next.config.js, no exported configuration found./
/Warning: Detected next.config.js, no exported configuration found. https:\/\/err.sh\/zeit\/next.js\/empty-configuration/
)
})
})