-
Notifications
You must be signed in to change notification settings - Fork 19
/
gatsby-node.ts
32 lines (29 loc) · 1.04 KB
/
gatsby-node.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { GatsbyNode } from 'gatsby'
/* eslint-disable func-names */
export { createPages } from './src/gatsby/createPages'
export { onCreatePage } from './src/gatsby/onCreatePage'
export const onCreateWebpackConfig: GatsbyNode['onCreateWebpackConfig'] = ({
stage,
actions,
getConfig,
}) => {
if (stage === 'build-html') {
actions.setWebpackConfig({
// Don't bundle modules that reference browser globals such as `window` and `IDBIndex` during SSR.
// See: https://github.com/gatsbyjs/gatsby/issues/17725
externals: getConfig().externals.concat(function (
_context: any,
request: string,
callback: (arg0: null | undefined, arg1: string | undefined) => void
) {
// Exclude bundling firebase* and react-firebase*
// These are instead required at runtime.
if (/^@?(react-)?firebase(.*)/.test(request)) {
console.log(`Excluding bundling of: ${request}`)
return callback(null, `umd ${request}`)
}
callback(undefined, undefined)
}),
})
}
}