Skip to content

Commit cf4b10c

Browse files
authored
fix various issues (#4316)
1 parent afaa093 commit cf4b10c

File tree

6 files changed

+7
-12
lines changed

6 files changed

+7
-12
lines changed

packages-exp/messaging-exp/rollup.config.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ const es5Builds = [
4242
{ file: pkg.module, format: 'es', sourcemap: true }
4343
],
4444
plugins: es5BuildPlugins,
45-
treeshake: {
46-
moduleSideEffects: false
47-
},
4845
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
4946
}
5047
];
@@ -73,9 +70,6 @@ const es2017Builds = [
7370
sourcemap: true
7471
},
7572
plugins: es2017BuildPlugins,
76-
treeshake: {
77-
moduleSideEffects: false
78-
},
7973
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
8074
},
8175

packages-exp/messaging-exp/rollup.config.release.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const es5Builds = [
4747
],
4848
plugins: es5BuildPlugins,
4949
treeshake: {
50-
moduleSideEffects: false
50+
moduleSideEffects: (id, external) => id === '@firebase/installations'
5151
},
5252
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
5353
}
@@ -81,7 +81,7 @@ const es2017Builds = [
8181
},
8282
plugins: es2017BuildPlugins,
8383
treeshake: {
84-
moduleSideEffects: false
84+
moduleSideEffects: (id, external) => id === '@firebase/installations'
8585
},
8686
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
8787
},
@@ -93,7 +93,7 @@ const es2017Builds = [
9393
plugins: es5BuildPlugins,
9494
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)),
9595
treeshake: {
96-
moduleSideEffects: false
96+
moduleSideEffects: (id, external) => id === '@firebase/installations'
9797
}
9898
}
9999
];

packages-exp/messaging-exp/src/api/onBackgroundMessage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export function onBackgroundMessage(
2626
messaging: MessagingService,
2727
nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>
2828
): Unsubscribe {
29-
if (!!navigator) {
29+
if (self.document !== undefined) {
3030
throw ERROR_FACTORY.create(ErrorCode.AVAILABLE_IN_SW);
3131
}
3232

packages-exp/messaging-exp/src/index.sw.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import { FirebaseMessaging } from '@firebase/messaging-types-exp';
1919
import { registerMessaging } from './helpers/register';
20+
import '@firebase/installations-exp';
2021

2122
export { onBackgroundMessage, getMessaging } from './api';
2223

packages-exp/messaging-exp/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import { FirebaseMessaging } from '@firebase/messaging-types-exp';
1919
import { registerMessaging } from './helpers/register';
20+
import '@firebase/installations-exp';
2021

2122
export { getToken, deleteToken, onMessage, getMessaging } from './api';
2223

packages-exp/messaging-exp/src/internals/requests.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import { SubscriptionOptions, TokenDetails } from '../interfaces/token-details';
2121

2222
import { AppConfig } from '../interfaces/app-config';
2323
import { FirebaseInternalDependencies } from '../interfaces/internal-dependencies';
24-
import { getToken } from '@firebase/installations-exp';
2524

2625
export interface ApiResponse {
2726
token?: string;
@@ -155,7 +154,7 @@ async function getHeaders({
155154
appConfig,
156155
installations
157156
}: FirebaseInternalDependencies): Promise<Headers> {
158-
const authToken = await getToken(installations);
157+
const authToken = await installations.getToken();
159158

160159
return new Headers({
161160
'Content-Type': 'application/json',

0 commit comments

Comments
 (0)