-
Notifications
You must be signed in to change notification settings - Fork 2
/
gatsby-node.js
33 lines (30 loc) · 1013 Bytes
/
gatsby-node.js
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
33
/**
* Implement Gatsby's Node APIs in this file.
*
* See: https://www.gatsbyjs.org/docs/node-apis/
*/
// You can delete this file if you're not using it
// ================================================
// ================================================
// ======= ignore firebase when it's being built
exports.onCreateWebpackConfig = ({ stage, actions, getConfig }) => {
if (stage === 'build-html' || stage === 'develop-html') {
actions.setWebpackConfig({
externals: getConfig().externals.concat(function(context, request, callback) {
const regex = /^@?firebase(\/(.+))?/
// exclude firebase products from being bundled, so they will be loaded using require() at runtime.
if (regex.test(request)) {
return callback(null, 'umd ' + request)
}
callback()
}),
})
}
}
exports.onCreatePage = ({ page, actions }) => {
const { createPage } = actions;
if (page.path === `/`) {
page.matchPath = `/*`;
createPage(page);
}
};