Bug report
Describe the bug
Errors are shown in the logs when trying to import child_process in an api function.
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
- Create an api function
// /pages/api/hello.js
import 'child_process';
export default (req, res) => {
res.end('hello');
};
- start next dev server
- visit
http://localhost:3000/api/hello in the browser
- See error
[ error ] ./pages/api/hello.js
Module not found: Can't resolve 'child_process' in '<project-root>/pages/api'
Expected behavior
No error
Screenshots
If applicable, add screenshots to help explain your problem.
System information
- OS: macOS
- Version of Next.js: 8.1.1-canary.28
Additional context
Functionally there doesn't seem to be any problem, looks like it's just a logging problem.