Closed HermanBilous closed 9 months ago
I'm not sure if this was fixed, but it seems doable:
Quick example:
import ms from 'milsymbol';
const symbol = new ms.Symbol("sfgpewrh--mt");
const canvasElement = symbol.asCanvas(1)
const symbolElement = symbol.asDOM();
export const IconsTest = () => {
const containerRef = useRef<HTMLDivElement>(null);
// const svgRef = useRef<SVGElement>(null);
useEffect(() => {
// svgRef.current!.innerHTML = symbolElement.innerHTML;
containerRef.current!.appendChild(canvasElement);
containerRef.current!.appendChild(symbolElement);
}, []);
return (
<div ref={containerRef}/>
);
}
Hey @ben-xD, thanks. Perhaps I should have phrased my issue title better: there is no way to import milsymbol from index.esm.js. Like I wrote in the original post, import ms from 'milsymbol';
works, but I want to import from index.esm.js. This way, the import will be tree-shakeable. I have a fork of this package where I utilized it to a certain extent.
Since I’m a bit unsure about what changes that needs to be done to get this working in the correct way, I would love to get a pull with the changes that needs to be done.
Last time I tried to update package.json to fix this it ended up breaking the import in angular if I recall correctly.
Hi! Thanks for the package. It's awesome!
I've been trying to import the package as an es module in my react app, but failed. Basically, what I was expecting to do:
pnpm i milsymbol
ms.addIcons(std2525d);