0

I want to dynamically import components into Nextjs without dynamic function The problem I have with dynamic function is code splitting.

I want to dynamically import 20 components and dynamic function make 20 js files and I think this is not a good idea

ali marefati
  • 50
  • 1
  • 4
  • 1
    "I think this is not a good idea" - why not, could you be more specific about the problem you are trying to solve? Dynamic imports implies code splitting AFAIK, that's kind of the point. – lawrence-witt Jun 05 '22 at 12:27
  • @lawrence-witt I want to implement a site where the user can dynamically create a page through the admin panel and use ready-made components that have already been created. Now, if we have used dynamic function and adding 20 component then nextjs make 20 js file that it is not necessary and has a bad effect on performance – ali marefati Jun 05 '22 at 12:55
  • i found solution in this link https://stackoverflow.com/questions/48268507/react-dynamically-import-components – ali marefati Jun 10 '22 at 07:36

0 Answers0