Skip to content

Commit cd15df0

Browse files
authored
Fix nodejs builds (#5400)
* remove named export from app-compat * cjs build * firestoer lite export * changeset
1 parent 3a50e2f commit cd15df0

File tree

10 files changed

+33
-10
lines changed

10 files changed

+33
-10
lines changed

.changeset/eleven-swans-drive.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'@firebase/analytics-compat': patch
3+
'@firebase/app-check-compat': patch
4+
'@firebase/app-compat': patch
5+
'@firebase/functions-compat': patch
6+
---
7+
8+
Fix cjs builds by removing the named export from app-compat

.changeset/late-bobcats-swim.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/firestore': patch
3+
---
4+
5+
Make firestore/lite available in nodejs

packages/analytics-compat/src/service.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717
import { expect, use } from 'chai';
1818
import { AnalyticsService } from './service';
19-
import { firebase, FirebaseApp } from '@firebase/app-compat';
19+
import firebase, { FirebaseApp } from '@firebase/app-compat';
2020
import * as analyticsExp from '@firebase/analytics';
2121
import { stub, match, SinonStub } from 'sinon';
2222
import * as sinonChai from 'sinon-chai';

packages/app-check-compat/src/service.test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717
import { expect, use } from 'chai';
1818
import { AppCheckService } from './service';
19-
import { firebase, FirebaseApp } from '@firebase/app-compat';
19+
import firebase, { FirebaseApp } from '@firebase/app-compat';
2020
import * as appCheckExp from '@firebase/app-check';
2121
import { stub, match, SinonStub } from 'sinon';
2222
import * as sinonChai from 'sinon-chai';
@@ -65,7 +65,7 @@ describe('Firebase App Check > Service', () => {
6565

6666
it(
6767
'activate("string") calls modular initializeAppCheck() with a ' +
68-
'ReCaptchaV3Provider',
68+
'ReCaptchaV3Provider',
6969
() => {
7070
const initializeAppCheckStub = stub(appCheckExp, 'initializeAppCheck');
7171
service = new AppCheckService(app);
@@ -80,7 +80,7 @@ describe('Firebase App Check > Service', () => {
8080

8181
it(
8282
'activate(CustomProvider) calls modular initializeAppCheck() with' +
83-
' a CustomProvider',
83+
' a CustomProvider',
8484
() => {
8585
const initializeAppCheckStub = stub(appCheckExp, 'initializeAppCheck');
8686
service = new AppCheckService(app);
@@ -167,7 +167,7 @@ describe('Firebase App Check > Service', () => {
167167

168168
it('onTokenChanged() throws if activate() has not been called', async () => {
169169
service = createTestService(app);
170-
expect(() => service.onTokenChanged(() => {})).to.throw(
170+
expect(() => service.onTokenChanged(() => { })).to.throw(
171171
AppCheckError.USE_BEFORE_ACTIVATION
172172
);
173173
});

packages/app-compat/src/index.lite.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import { createFirebaseNamespaceLite } from './lite/firebaseNamespaceLite';
1919
import { registerCoreComponents } from './registerCoreComponents';
2020

21-
export const firebase = createFirebaseNamespaceLite();
21+
const firebase = createFirebaseNamespaceLite();
2222

2323
registerCoreComponents('lite');
2424

packages/app-compat/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ if (isBrowser() && (self as any).firebase !== undefined) {
3939
}
4040
}
4141

42-
export const firebase = firebaseNamespace;
42+
const firebase = firebaseNamespace;
4343

4444
registerCoreComponents();
4545

packages/firestore/package.json

+10
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@
4545
"test:prepare": "node ./scripts/prepare-test.js",
4646
"typings:public": "node ../../scripts/exp/use_typings.js ./dist/index.d.ts"
4747
},
48+
"exports": {
49+
".": {
50+
"node": "./dist/index.node.cjs.js",
51+
"default": "./dist/index.esm2017.js"
52+
},
53+
"./lite": {
54+
"node": "./dist/lite/index.node.cjs.js",
55+
"default": "./dist/lite/index.browser.esm2017.js"
56+
}
57+
},
4858
"main": "dist/index.node.cjs.js",
4959
"main-esm": "dist/index.node.cjs.esm2017.js",
5060
"react-native": "dist/index.rn.js",

packages/functions-compat/src/callable.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import { expect } from 'chai';
1818
import { FunctionsErrorCode } from '@firebase/functions';
1919
import { createTestService } from '../test/utils';
20-
import { firebase, FirebaseApp } from '@firebase/app-compat';
20+
import firebase, { FirebaseApp } from '@firebase/app-compat';
2121

2222
// eslint-disable-next-line @typescript-eslint/no-require-imports
2323
export const TEST_PROJECT = require('../../../config/project.json');

packages/functions-compat/src/index.node.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*/
1717

18-
import { firebase } from '@firebase/app-compat';
18+
import firebase from '@firebase/app-compat';
1919
import { name, version } from '../package.json';
2020
import { registerFunctions } from './register';
2121

packages/functions-compat/src/service.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import { expect, use } from 'chai';
1818
import { createTestService } from '../test/utils';
1919
import { FunctionsService } from './service';
20-
import { firebase, FirebaseApp } from '@firebase/app-compat';
20+
import firebase, { FirebaseApp } from '@firebase/app-compat';
2121
import * as functionsExp from '@firebase/functions';
2222
import { stub, match, SinonStub } from 'sinon';
2323
import * as sinonChai from 'sinon-chai';

0 commit comments

Comments
 (0)