Last active
June 21, 2016 04:56
-
-
Save ivanoats/853d0e832faa70e0541166a4027affe7 to your computer and use it in GitHub Desktop.
two versions, one based on README and another based on removing eslint warnings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function modifyWebpackConfig (config) { | |
// Object.assign is not picked up as mutation by immutable linter ?! | |
config.loader('jpg', (cfg) => Object.assign( | |
cfg, | |
{ | |
test: /\.jpe?g$|\.gif$|\.png$/i, | |
loader: 'file-loader?name=images/[name].[ext]', | |
} | |
)) | |
return config | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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$|\.gif$|\.png$/i, | |
loader: 'file-loader?name=images/[name].[ext]', | |
} | |
}) | |
return config | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// eslint-disable-next-line immutable/no-mutation,no-unused-vars | |
exports.modifyWebpackConfig = function (config, env) { | |
config.loader('jpg', (cfg) => { | |
// eslint-disable-next-line immutable/no-mutation,no-param-reassign | |
cfg.test = /\.jpe?g$|\.gif$|\.png$/i | |
// eslint-disable-next-line immutable/no-mutation,no-param-reassign | |
cfg.loader = 'file-loader?name=images/[name].[ext]' | |
return cfg | |
}) | |
return config | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment