You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
635 B
26 lines
635 B
const path = require('path');
|
|
|
|
module.exports = {
|
|
process(src, filename) {
|
|
const assetFilename = JSON.stringify(path.basename(filename));
|
|
|
|
if (filename.match(/\.svg$/)) {
|
|
return `module.exports = {
|
|
__esModule: true,
|
|
default: ${assetFilename},
|
|
ReactComponent: ({ svgRef, ...props }) => ({
|
|
$$typeof: Symbol.for('react.element'),
|
|
type: 'svg',
|
|
ref: svgRef || null,
|
|
key: null,
|
|
props: Object.assign({}, props, {
|
|
children: ${assetFilename}
|
|
})
|
|
}),
|
|
};`;
|
|
}
|
|
|
|
return `module.exports = ${assetFilename};`;
|
|
},
|
|
};
|