Questions & Answers

Module not found error due to a file not being exported from @firebase/database-compat

I'm having an issue with the following error:

Module not found: Error: Package path ./standalone is not exported from package C:\Users\brohj\WebstormProjects\ReactExpressFirebaseAuth\node_modules\@firebase\database-compat (see exports field in C:\Users\brohj\WebstormProjects\ReactExpressFirebaseAuth\node_modules\@firebase\database-compat\package.json).

The index.standalone.js file contains required files that were polyfilled in the webpack.config file. Could this be affecting the export?

Here are the fallback entries in the webpack.config file: 'node_modules/react-scripts/config'

module.exports = function(webpackEnv) {
    resolve: {

    alias: {
    // added code:
    fallback: {
                "assert": require.resolve("assert/"),
                "stream": require.resolve("stream-browserify"),
                "url": require.resolve("url/"),
                "util": require.resolve("util/"),
                "crypto": require.resolve("crypto-browserify"),
                "os": require.resolve("os-browserify/browser"),
                "querystring": require.resolve("querystring-es3"),
                "buffer": require.resolve("buffer/"),
                "https": require.resolve("https-browserify"),
                "http": require.resolve("stream-http"),
                "constants": require.resolve("constants-browserify"),
                "zlib": false,
                "fs": false,
                "net": false,
                "tls": false,



  "name": "@firebase/database-compat/standalone",
  "description": "The entry point for sharing code with Admin SDK",
  "main": "../dist/index.standalone.js", // file being exported, suppposedly.
  "typings": "../dist/database-compat/src/index.standalone.d.ts",
  "private": true,



Object.defineProperty(exports, '__esModule', { value: true });

var require$$2 = require('util');
var require$$0 = require('buffer');
var require$$1 = require('events');
var require$$0$1 = require('stream');
var require$$1$1 = require('crypto');
var require$$2$1 = require('url');
var require$$0$2 = require('assert');
var require$$1$2 = require('net');
var require$$2$2 = require('tls');
var require$$1$3 = require('@firebase/util');
var require$$2$3 = require('tslib');
var require$$3 = require('@firebase/logger');
var component = require('@firebase/component');


I've been googling and looking at solutions on StackOverflow and this is as far as I've been able to progress. I got the errors caused by the lack of support by webpack 5 from 190 errors down to 4 files that are looking for a ./standalone.js file export that isn't happening. I've presented one of the four errors.

Next I will try snowpack and see if there are any differences in errors. If I come up with a solution, I will let you know. Otherwise, I'm open to suggestions.


2023-01-22 23:25:04
Looks like snowpack is no longer being supported.
2023-01-22 23:25:04
Any update on this? facing the same problem.
2023-01-22 23:25:04
It's been a while. SO is not as good as it used to one has answered this. What I ended up doing was upgrading Firebase to version 9 and started using yarn as my build tool and I didn't have this issue after that.
Answers(1) :

Upgraded Firebase to the latest version and started using yarn as my build tool and I didn't have this issue after that.