Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
SVG preset for Neutrino
// jest.config.js
const neutrino = require('neutrino');
process.env.NODE_ENV = process.env.NODE_ENV || 'test';
module.exports = neutrino().customJest();
module.exports = neutrino => {
neutrino.config.resolve.extensions.add('.svg')
const test = neutrino.config.module
.rule('image')
.get('test')
.toString()
.replace('|svg', '')
neutrino.config.module.rule('image').test(test)
neutrino.config.module
.rule('svg')
.test(/\.svg$/)
.use('webpack')
.loader('@svgr/webpack')
.options({ svgAttributes: { role: 'img' }, titleProp: true })
.end()
.use('file')
.loader('file-loader')
neutrino.register('customJest', neutrino => {
const jestConfig = neutrino().jest();
// modify jestConfig.moduleNameMapper
return jestConfig;
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.