Imported config files and start script from new create react app

This commit is contained in:
Alejandro Celaya
2019-01-05 22:54:54 +01:00
parent 835d54e90c
commit 08488e9bad
13 changed files with 767 additions and 810 deletions

View File

@@ -1,3 +1,4 @@
'use strict';
const path = require('path');
@@ -6,6 +7,24 @@ const path = require('path');
module.exports = {
process(src, filename) {
return `module.exports = ${JSON.stringify(path.basename(filename))};`;
const assetFilename = JSON.stringify(path.basename(filename));
if (filename.match(/\.svg$/)) {
return `module.exports = {
__esModule: true,
default: ${assetFilename},
ReactComponent: (props) => ({
$$typeof: Symbol.for('react.element'),
type: 'svg',
ref: null,
key: null,
props: Object.assign({}, props, {
children: ${assetFilename}
})
}),
};`;
}
return `module.exports = ${assetFilename};`;
},
};