-
Notifications
You must be signed in to change notification settings - Fork 0
/
gatsby-node.js
41 lines (39 loc) · 1.19 KB
/
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
34
35
36
37
38
39
40
41
const path = require("path");
exports.onCreateWebpackConfig = ({ actions, stage, getConfig }) => {
if (stage === "build-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();
}),
});
}
actions.setWebpackConfig({
resolve: {
alias: {
components: path.resolve(__dirname, "src/components"),
pages: path.resolve(__dirname, "src/pages"),
assets: path.resolve(__dirname, "src/assets"),
routes: path.resolve(__dirname, "src/routes"),
context: path.resolve(__dirname, "src/context"),
},
},
});
};
exports.onCreatePage = ({ page, actions }) => {
const { createPage } = actions;
// Make the front page match everything client side.
// Normally your paths should be a bit more judicious.
if (page.path === `/`) {
page.matchPath = `/*`;
createPage(page);
}
};