Any way to hide logs about React.js dynamic lazy imports? #19308
Unanswered
perisicnikola37
asked this question in
Q&A
Replies: 2 comments 3 replies
-
I guess it's just because those components are not bundled anymore.
You can add |
Beta Was this translation helpful? Give feedback.
0 replies
-
Already tried that and got the following: 48 | return React.lazy(
49 | () => import(
50 | `../components/${component}.tsx`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
51 | /* @vite-ignore */
52 | )
The above dynamic import cannot be analyzed by Vite.
See https://github.com/rollup/plugins/tree/master/packages/dynamic-import-vars#limitations for supported dynamic import formats. If this is intended to be left as-is, you can use the /* @vite-ignore */ comment inside the import() call to suppress this warning. I used this: const [
AnimatedScore,
FireworksCanvas,
Header,
URLForm,
LoadingErrorMessages,
RadarChartSection,
ExceededSentences,
Footer,
SubHeader,
] = [
'AnimatedScore',
'FireworksCanvas',
'Header',
'URLForm',
'LoadingErrorMessages',
'RadarChartSection',
'ExceededSentences',
'Footer',
'SubHeader',
].map((component) => {
return React.lazy(
() => import(`../components/${component}.tsx` /* @vite-ignore */),
)
}) |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello.
I'm using map for dynamic lazy imports in React.js like this:
I've done that because of drastical(75%) improvement in building time.
And now I have this in my terminal output:
Is there any way to hide this?
Beta Was this translation helpful? Give feedback.
All reactions