Running npm run build or deploying to now generates the error below
I made a small repo here
To replicate issue:
Additional notes:
npm run dev works fine, locally. I can't deploy due to error.target: 'serverless' removes the error on build but I can't deploy it without the serverless configFailed to compile.
./node_modules/@firebase/database/dist/index.node.cjs.js
Module not found: Can't resolve 'request' in '/Users/next -firebase/node_modules/@firebase/database/dist'
> Build error occurred
Error: > Build failed because of webpack errors
at Object.build [as default] (/Users/next-firebase/node_modules/next/dist/build/index.js:99:15)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! create-next-example-app@ build: `next build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the create-next-example-app@ build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
I'm also having this same problem with the Firebase Hosting example. Would love to hear your solution to this problem if you found one.
It looks like this import in index.js is causing the deployment problem:
import { database } from 'firebase';
The file doesn't seem to be using this import at all, so you can safely remove it. I can see you are importing individual firebase packages correctly via the rebase.js file.
Without this line, the deployment is successful, but the app still doesn't work. It's probably related to this:
https://spectrum.chat/next-js/general/import-firebase-firestore-causing-error-on-the-client~5a0570ff-1ccc-4abd-b23a-01272344154f
We're adding support for Firebase in serverless soon, we'll post here when we have an update!
@Timer Is there a workaround in the mean time? Thanks!
@Timer hey sorry to bodder you Joe, is there any fix encounter soon? (all good on dev server, but still cannot build using firebase even old versions).
Many thanks
@scemii hey! We finalized some changes needed, but we're focusing on releasing Next 9 right now. 馃檹
This is one of our high priority items right after 9.0 ships!
@Timer Hi, thank you for the support ! Do you have any ETA for this ?
Most helpful comment
@Timer Hi, thank you for the support ! Do you have any ETA for this ?