Incorrect usage of Next.js loader with codegen.

Just want to report an issue that took me a good bit of time to debug:

• When using codegen you cannot use the next.js loader, as it requires options that break the user data context from being properly set
• The supabase auth codegen example does this, but it doesn’t have comments or docs, and I also don’t see docs on the docs site
• I understand now what is going on and that the fact that it requires a loader is a sign that it is dynamically loading components and not in codegen, but it is a bit of a sharp edge

that’s right, you can’t mix loader and codegen… could you point me to where we are mixing them up?

ya; to this point; it’d be good if there was some kind of tutorial on how to go from one to the other.

I’ve run into this during a couple of different scenarios where I’ve started out as loader and then want to go to codegen:

  1. what i’m building doesn’t require any custom code components to begin with
  2. i’m doing local development and everything is working fine as loader; but then I want to deploy to vercel or cloudflare and need to be codegen

hmm custom code components and deploying to vercel should work for both loader and codegen :thinking_face:

what about cloudflare pages?

i think this page is what led me to believe the difference was with the deployment startegy

https://docs.plasmic.app/learn/loader-vs-codegen/

ah yeah cloudflare workers cannot use loader because it evaluates code :pensive:

adding to this; I think another difficulty is that the create-plasmic-app only has the feature for creating an app using app routing in loader mode, so if you’re trying to start using plasmic and understand what the folder and file structure would be for nextjs routing with app; you’re likely going to start it with loader to begin with

We don’t actually recommend using plasmic with the app router and codegen at the moment, as we can’t support extracting query data at build time with the app router. So you’ll have to use the /pages router with plasmic for now :pensive:

is this something that is on the roadmap at all?