Skip to content

Commit

Permalink
added icons
Browse files Browse the repository at this point in the history
  • Loading branch information
tuan2311 committed Aug 6, 2020
1 parent e492337 commit 3427037
Show file tree
Hide file tree
Showing 9 changed files with 914 additions and 13 deletions.
45 changes: 39 additions & 6 deletions gatsby-node.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,44 @@
const path = require('path');
const { merge } = require('webpack-merge');

exports.onCreateWebpackConfig = ({ actions }) => {
actions.setWebpackConfig({
resolve: {
alias: {
'~': path.resolve(__dirname, 'src'),
exports.onCreateWebpackConfig = ({ actions, getConfig }) => {
let config = getConfig();
config.module.rules = config.module.rules.map((item) => {
const { test } = item;

if (test && test.toString().includes('svg')) {
return {
...item,
exclude: [path.resolve(__dirname, 'src', 'icons')],
};
}
return {
...item,
};
});

config = merge(
{
resolve: {
alias: {
'~': path.resolve(__dirname, 'src'),
},
},
module: {
rules: [
{
test: /\.svg$/,
use: [
{ loader: 'svg-sprite-loader' },
'svg-transform-loader',
'svgo-loader',
],
include: [path.resolve(__dirname, 'src', 'icons')],
},
],
},
},
});
config
);
actions.replaceWebpackConfig(config);
};
Loading

0 comments on commit 3427037

Please sign in to comment.