Skip to content

Commit 1fce8f4

Browse files
authored
create component bundles in umd to support lazy loading in requireJS (#1325)
* create component bundles in umd to support lazy loading in requireJS * [AUTOMATED]: Prettier Code Styling
1 parent 5bac19c commit 1fce8f4

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

packages/firebase/rollup.config.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,27 @@ const componentBuilds = components
110110
input: `${component}/index.ts`,
111111
output: {
112112
file: `firebase-${component}.js`,
113-
format: 'iife',
113+
format: 'umd',
114114
sourcemap: true,
115115
extend: true,
116116
name: GLOBAL_NAME,
117117
globals: {
118118
'@firebase/app': GLOBAL_NAME
119119
},
120-
banner: `try {`,
121-
footer: `} catch(err) {
120+
121+
/**
122+
* use iife to avoid below error in the old Safari browser
123+
* SyntaxError: Functions cannot be declared in a nested block in strict mode
124+
* https://github.com/firebase/firebase-js-sdk/issues/1228
125+
*
126+
*/
127+
128+
intro: `
129+
try {
130+
(function() {`,
131+
outro: `
132+
}).apply(this, arguments);
133+
} catch(err) {
122134
console.error(err);
123135
throw new Error(
124136
'Cannot instantiate firebase-${component} - ' +

0 commit comments

Comments
 (0)