mirror of
https://github.com/ritz078/transform.git
synced 2026-11-21 00:32:56 +03:00
26 lines
465 B
TypeScript
26 lines
465 B
TypeScript
import convert from "@svgr/core/lib/convert";
|
|
|
|
const _self: any = self;
|
|
|
|
_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
|
|
});
|
|
}
|
|
};
|