drinking-code / openmoji-for-react

i reactified openmoji
2 stars 0 forks source link

Yarn add error #11

Closed laem closed 2 years ago

laem commented 2 years ago

Hi, I get this error when trying to install this lib.

Probably comes from this namespace "sodipodi:docname="flag-quebec.svg"". I've seen then being produced by inkscape. @SVGO removes them.

Could probably be resolved by using @svgr here : https://github.com/drinking-code/openmoji-for-react/blob/master/build/correct-dom-properties.js

[5/6] Building fresh packages...
error XXX/node_modules/react-openmoji: Command failed.
Exit code: 1
Command: node build/build.js && npx babel --presets @babel/preset-react src --out-dir lib --copy-files && node build/correct-dom-properties.js && rm -rf src
Arguments: 
Directory: node_modules/react-openmoji
Output:
SyntaxError:XXX/node_modules/react-openmoji/src/icons/1F3F4-E0063-E0061-E0071-E0063-E007F.js: Namespace tags are not supported by default. React's JSX doesn't support namespace tags. You can set `throwIfNamespace: false` to bypass this warning.
   5 |     if (!outline) {
   6 |         return (
>  7 |             <svg width={size} height={size} className="openmoji" viewBox="0 0 72 72" version="1.1" sodipodi:docname="flag-quebec.svg" xmlns="http://www.w3.org/2000/svg" ><g id="line-supplement"><path stroke-width="1.849" d="m5 40.5v14.5h26v-14.5h-26zm13.521 2.4785a0.68564 0.68564 0 0 1 0.68555 0.68555v4.8242h0.20312c0.064592-0.48327 0.2712-0.91288 0.58398-1.2344 0.36396-0.3741 0.83888-0.61685 1.3594-0.77148a0.51863 0.51863 0 0 1 0.14648-0.021484 0.51863 0.51863 0 0 1 0.49805 0.37109 0.51863 0.51863 0 0 1-0.34961 0.64453c-0.39915 0.11858-0.71132 0.29362-0.91211 0.5-0.14013 0.14403-0.21782 0.314
drinking-code commented 2 years ago

Hey, thanks for pointing that out! I'll take a look at it.

drinking-code commented 2 years ago

Some background info: I already had a mechanism for removing namespace attributes, but it only removed the xmlns namespace declarations. I changed this now to removing all namespace attributes, assuming that these are irrelevant (just like the sodipodi docname in this case).

laem commented 2 years ago

I don't know if it helps, but I finally went for this piece of code, simpler and fit for my purpose : https://github.com/laem/futureco/blob/e95a404946b97441cdfd382e8deb1831c44993f8/source/components/Emoji.tsx