build(#10336): use unpkg for storybook twemojis

This commit is contained in:
Acid Chicken (硫酸鶏) 2023-04-01 23:04:08 +09:00
parent 3f4d93a287
commit edeabac8f7
No known key found for this signature in database
GPG Key ID: 3E87B98A3F6BAB99

View File

@ -10,7 +10,7 @@ export const onUnhandledRequest = ((req, print) => {
export const commonHandlers = [
rest.get('/twemoji/:codepoints.svg', async (req, res, ctx) => {
const { codepoints } = req.params;
const file = await import(`../node_modules/@discordapp/twemoji/dist/svg/${codepoints}.svg?raw`);
return res(ctx.set('Content-Type', 'image/svg+xml'), ctx.body(file.default));
const value = await fetch(`https://unpkg.com/@discordapp/twemoji@14.1.2/dist/svg/${codepoints}.svg`).then((response) => response.blob());
return res(ctx.set('Content-Type', 'image/svg+xml'), ctx.body(value));
}),
];