admin管理员组文章数量:1026989
Given a new React app using Vite with no content yet ( .tsx )
When I'm using Tabler Icons for React ( ) and change the content of main.tsx to this ( .tsx )
import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import { IconArrowLeft } from '@tabler/icons-react';
createRoot(document.getElementById('root')!).render(
<StrictMode>
<div>
<div>See icon below</div>
<IconArrowLeft />
</div>
</StrictMode>
);
I get huge performance issues. The initial load time is increased and whenever I'm refreshing the page it takes a lot of time. Did I miss something in the docs I should setup before using the icons?
I see a lot of network requests for tabler, it seems the library is fetching some chunks first.
Given a new React app using Vite with no content yet ( https://stackblitz/edit/vitejs-vite-7xucud?file=src%2Fmain.tsx )
When I'm using Tabler Icons for React ( https://tabler.io/docs/icons/react ) and change the content of main.tsx to this ( https://stackblitz/edit/vitejs-vite-sszcqw?file=src%2Fmain.tsx )
import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import { IconArrowLeft } from '@tabler/icons-react';
createRoot(document.getElementById('root')!).render(
<StrictMode>
<div>
<div>See icon below</div>
<IconArrowLeft />
</div>
</StrictMode>
);
I get huge performance issues. The initial load time is increased and whenever I'm refreshing the page it takes a lot of time. Did I miss something in the docs I should setup before using the icons?
I see a lot of network requests for tabler, it seems the library is fetching some chunks first.
Share Improve this question edited Nov 16, 2024 at 10:46 baitendbidz asked Nov 16, 2024 at 10:43 baitendbidzbaitendbidz 8054 gold badges22 silver badges71 bronze badges 4 |1 Answer
Reset to default 12try adding this to the vite.config.ts file:
Credit: https://github/tabler/tabler-icons/issues/1233#issuecomment-2428245119
export default defineConfig({
plugins: [react()],
resolve: {
alias: {
...
'@tabler/icons-react': '@tabler/icons-react/dist/esm/icons/index.mjs',
},
}
Given a new React app using Vite with no content yet ( .tsx )
When I'm using Tabler Icons for React ( ) and change the content of main.tsx to this ( .tsx )
import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import { IconArrowLeft } from '@tabler/icons-react';
createRoot(document.getElementById('root')!).render(
<StrictMode>
<div>
<div>See icon below</div>
<IconArrowLeft />
</div>
</StrictMode>
);
I get huge performance issues. The initial load time is increased and whenever I'm refreshing the page it takes a lot of time. Did I miss something in the docs I should setup before using the icons?
I see a lot of network requests for tabler, it seems the library is fetching some chunks first.
Given a new React app using Vite with no content yet ( https://stackblitz/edit/vitejs-vite-7xucud?file=src%2Fmain.tsx )
When I'm using Tabler Icons for React ( https://tabler.io/docs/icons/react ) and change the content of main.tsx to this ( https://stackblitz/edit/vitejs-vite-sszcqw?file=src%2Fmain.tsx )
import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import { IconArrowLeft } from '@tabler/icons-react';
createRoot(document.getElementById('root')!).render(
<StrictMode>
<div>
<div>See icon below</div>
<IconArrowLeft />
</div>
</StrictMode>
);
I get huge performance issues. The initial load time is increased and whenever I'm refreshing the page it takes a lot of time. Did I miss something in the docs I should setup before using the icons?
I see a lot of network requests for tabler, it seems the library is fetching some chunks first.
Share Improve this question edited Nov 16, 2024 at 10:46 baitendbidz asked Nov 16, 2024 at 10:43 baitendbidzbaitendbidz 8054 gold badges22 silver badges71 bronze badges 4-
You can try import
'import IconArrowLeft from '@tabler/icons-react/IconArrowLeft';
– antokhio Commented Nov 16, 2024 at 10:45 -
That didn't work, the file doesn't exist. Also tried
iconArrowLeft
,icon-arrow-left
andicon_arrow_left
– baitendbidz Commented Nov 16, 2024 at 10:48 - 1 same issue? github/tabler/tabler-icons/issues/1233 – cmgchess Commented Nov 16, 2024 at 10:56
- yeah, this seems to be the issue! – baitendbidz Commented Nov 16, 2024 at 11:19
1 Answer
Reset to default 12try adding this to the vite.config.ts file:
Credit: https://github/tabler/tabler-icons/issues/1233#issuecomment-2428245119
export default defineConfig({
plugins: [react()],
resolve: {
alias: {
...
'@tabler/icons-react': '@tabler/icons-react/dist/esm/icons/index.mjs',
},
}
本文标签: reactjsTabler icons for React slowing down app on initial loadStack Overflow
版权声明:本文标题:reactjs - Tabler icons for React slowing down app on initial load - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745660621a2161866.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
'import IconArrowLeft from '@tabler/icons-react/IconArrowLeft';
– antokhio Commented Nov 16, 2024 at 10:45iconArrowLeft
,icon-arrow-left
andicon_arrow_left
– baitendbidz Commented Nov 16, 2024 at 10:48