forked from anastasiyamak/kalco-landing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gatsby-node.js
33 lines (31 loc) · 1.01 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
const path = require('path');
// exports.onCreateWebpackConfig = ({ actions }) => {
// actions.setWebpackConfig({
// resolve: {
// modules: [path.resolve(__dirname, 'src'), 'node_modules'],
// },
// });
// };
exports.onCreateWebpackConfig = ({ stage, actions, getConfig }) => {
actions.setWebpackConfig({
resolve: {
modules: [path.resolve(__dirname, 'src'), 'node_modules'],
},
});
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();
}),
});
}
};