A way to dynamically load a component based on environment variable?
Unanswered
Rough harvester ant posted this in #help-forum
Rough harvester antOP
So I have a DevTools component that has to be conditionally loaded based on an environment variable.
This is a minimal repro: https://github.com/ryanditjia/next-lazy-component-env/commit/8a7242004e500f26a3a3d2d9e0506d9909bc6638 (I pointed to the commit, because the rest is boilerplate create-next-app).
I’ve attached a screenshot, you could see that the DevTools code incorrectly makes it to the layout bundle. Even though the UI is correctly not showing.
Is this a limitation with
This is a minimal repro: https://github.com/ryanditjia/next-lazy-component-env/commit/8a7242004e500f26a3a3d2d9e0506d9909bc6638 (I pointed to the commit, because the rest is boilerplate create-next-app).
Providers is there because there’ll be other client components in the layout; and because without it (or another client component in the layout) the layout chunk doesn’t get loaded in the network.I’ve attached a screenshot, you could see that the DevTools code incorrectly makes it to the layout bundle. Even though the UI is correctly not showing.
Is this a limitation with
next/dynamic?