[REQUIRED] Describe your environment
- Operating System version: Windows 10
- Firebase SDK version: 4.8.0
- Firebase Product: util (auth, database, storage, etc)
[REQUIRED] Describe the problem
When building a project with Google Closure Compiler (Advarnced) that imports firebase, then some util modules are being shaken off. That should stay in the code.
For some reason functions like deepCopy, createSubscribe and more, are removed from the build but still referent to in util/dist/esm/index.js. This results in variables not defined.
Uncaught ReferenceError: module$node_modules$$firebase$util$dist$esm$src$deepCopy is not defined
From the exported file. (The variables that does not have a $ prefix, are modules that were shaken away)
var $module$node_modules$$firebase$util$dist$esm$index$deepCopy$$ = module$node_modules$$firebase$util$dist$esm$src$deepCopy.$deepCopy$, $module$node_modules$$firebase$util$dist$esm$index$deepExtend$$ = module$node_modules$$firebase$util$dist$esm$src$deepCopy.$deepExtend$, $module$node_modules$$firebase$util$dist$esm$index$patchProperty$$ = module$node_modules$$firebase$util$dist$esm$src$deepCopy.$patchProperty$, $module$node_modules$$firebase$util$dist$esm$index$ErrorFactory$$ = module$node_modules$$firebase$util$dist$esm$src$errors.$ErrorFactory$,
$module$node_modules$$firebase$util$dist$esm$index$createSubscribe$$ = module$node_modules$$firebase$util$dist$esm$src$subscribe.$createSubscribe$;
Steps to reproduce:
Flag used to tree shake
--dependency_mode=STRICT
import { initializeApp } from 'firebase/app';
import 'firebase/messaging';
------------------------
const app = initializeApp(
{
apiKey: /* apiKey */,
authDomain: /* authDomain*/,
databaseURL: /* databaseURL*/,
projectId: /* projectId*/,
storageBucket: /* storageBucket*/,
messagingSenderId: /* messagingSenderId*/
}
);
NOTE: I have used the fix in #370 to build with Closure Compiler
Relevant Code:
[REQUIRED] Describe your environment
[REQUIRED] Describe the problem
When building a project with Google Closure Compiler (Advarnced) that imports firebase, then some util modules are being shaken off. That should stay in the code.
For some reason functions like deepCopy, createSubscribe and more, are removed from the build but still referent to in util/dist/esm/index.js. This results in variables not defined.
Uncaught ReferenceError: module$node_modules$$firebase$util$dist$esm$src$deepCopy is not defined
From the exported file. (The variables that does not have a $ prefix, are modules that were shaken away)
Steps to reproduce:
Flag used to tree shake
--dependency_mode=STRICT
NOTE: I have used the fix in #370 to build with Closure Compiler
Relevant Code: