Skip to content

Commit 58c12c5

Browse files
Fix production build Issue caused due to firebase with gatsby and webpack bundles (#2)
* Change name of package from pledge to coding juniors * Remove production build Issues caused due to firebase with gatsby and webpack
1 parent 572a37c commit 58c12c5

File tree

3 files changed

+3036
-8209
lines changed

3 files changed

+3036
-8209
lines changed

gatsby-node.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
exports.onCreateWebpackConfig = ({ stage, actions, getConfig }) => {
2+
if (stage === 'build-html') {
3+
actions.setWebpackConfig({
4+
// Don't bundle modules that reference browser globals such as `window` and `IDBIndex` during SSR.
5+
// See: https://github.com/gatsbyjs/gatsby/issues/17725
6+
externals: getConfig().externals.concat(function(_context, request, callback) {
7+
// Exclude bundling firebase* and react-firebase*
8+
// These are instead required at runtime.
9+
if (/^@?(react-)?firebase(.*)/.test(request)) {
10+
console.log('Excluding bundling of: ' + request);
11+
return callback(null, 'umd ' + request);
12+
}
13+
callback();
14+
}),
15+
});
16+
}
17+
};

0 commit comments

Comments
 (0)