forked from tejitpabari99/virtualCampus
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathgatsby-node.js
38 lines (36 loc) · 1.25 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
/**
* Implement Gatsby's Node APIs in this file.
*
* See: https://www.gatsbyjs.org/docs/node-apis/
*/
const Data = require('./src/assets/ResourcesData');
const campusCategoriesSubTemplate = require.resolve('./src/components/resources/campusCategoriesSubTemplate.js');
exports.createPages = ({ actions }) => {
const { createPage } = actions;
const campusCategoriesData = Data.CampusData;
Object.keys(campusCategoriesData).forEach(key => {
createPage({
path: campusCategoriesData[key]['pageURL'],
component: campusCategoriesSubTemplate,
context: campusCategoriesData[key]['data']
})
});
};
exports.onCreateWebpackConfig = ({
stage,
actions,
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();
})
});
}
};