diff --git a/lib/component/stringify.js b/lib/component/stringify.js index 861dcbc..788ce6e 100644 --- a/lib/component/stringify.js +++ b/lib/component/stringify.js @@ -8,13 +8,12 @@ module.exports = R.curry(function stringify (opts, tree) { 'var React = require(\'react\');', '', 'function ' + displayName + ' (props) {', + 'props = {...' + JSON.stringify(tree.props || {}) + ', ...props};\n', ]; var postamble = [ '}', '', - displayName + '.defaultProps = ' + JSON.stringify(tree.props || {}) + ';', - '', 'module.exports = ' + displayName + ';', '', displayName + '.default = ' + displayName + ';', diff --git a/test/unit/component/stringify.js b/test/unit/component/stringify.js index 2f9d702..d564110 100644 --- a/test/unit/component/stringify.js +++ b/test/unit/component/stringify.js @@ -39,13 +39,13 @@ describe('svg-react-loader/lib/component/stringify', () => { equal( 'var React = require(\'react\');\n\n' + 'function SvgReactComponent (props) {\n' + + 'props = {...' + JSON.stringify(expectedProps) + ', ...props};\n' + ' return React.createElement("svg",props,' + '[React.createElement("rect",{"x":"0","y":"0",' + '"width":"16","height":"16","fill":"#fff","key":0}),' + 'React.createElement("text",{"key":1},"Foobar")' + ']);\n' + '}\n\n' + - 'SvgReactComponent.defaultProps = ' + JSON.stringify(expectedProps) + ';\n\n' + 'module.exports = SvgReactComponent;\n\n' + 'SvgReactComponent.default = SvgReactComponent;\n' );