How to use the @svgr/core/lib/convert function in @svgr/core

To help you get started, we’ve selected a few @svgr/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ritz078 / transform / src / workers / svgr.worker.ts View on Github external
_self.onmessage = async ({ data: { payload, id } }) => {
  const { value, native } = payload;

  try {
    const result = await convert(value, {
      plugins: [require("@svgr/plugin-jsx").default],
      svgo: false,
      native
    });

    _self.postMessage({
      payload: result,
      id
    });
  } catch (e) {
    _self.postMessage({
      id,
      error: e.message
    });
  }
};