-
Notifications
You must be signed in to change notification settings - Fork 30.6k
Description
Examples bug report
Example name
api-routes-graphql
Describe the bug
When I changed the name of the GraphQL API file from /api/graphql.js to /api/index.js, I noticed that the following error appears when building (after executing next build)
Failed to compile.
./node_modules/busboy/lib/main.js
Module not found: Can't resolve 'fs' in '/Users/mzygmunt/apps/next.js/examples/api-routes-graphql/node_modules/busboy/lib'
Build error occurred
Error: > Build failed because of webpack errors
at build (/Users/mzygmunt/apps/next.js/examples/api-routes-graphql/node_modules/next/dist/build/index.js:6:847)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! api-routes-graphql@1.0.0 build:next build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the api-routes-graphql@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/mzygmunt/.npm/_logs/2019-07-27T09_46_44_792Z-debug.log
To Reproduce
- Clone example api-routes-graphql
- Change filename /api/graphql.js to /api/index.js
- Execure npm run build
- See error
Expected behavior
After changing the file name, API should be available at /api.
Screenshots
System information
- OS: macOS
- Browser (if applies) chrome
- Version of Next.js: 9.0.2 - 9.0.3-canary.3
