Skip to content

Instantly share code, notes, and snippets.

@ivanoats
Created July 5, 2016 21:22
Show Gist options
  • Save ivanoats/f8185cd16f7ef9fffe14a3b539bc0ab6 to your computer and use it in GitHub Desktop.
Save ivanoats/f8185cd16f7ef9fffe14a3b539bc0ab6 to your computer and use it in GitHub Desktop.
gatsby config
export function modifyWebpackConfig (config) {
// arrow-body-style rule doesn't recognize that the spread operator needs
// to be in an object literal
// eslint-disable-next-line arrow-body-style
config.loader('jpg', (cfg) => {
return {
...cfg,
test: /\.jpe?g$/i,
loader: 'file-loader?name=images/[name].[ext]',
}
})
// eslint-disable-next-line arrow-body-style
config.loader('png', (cfg) => {
return {
...cfg,
test: /\.png$/i,
loader: 'file-loader?name=images/[name].png',
}
})
return config
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment