Next.js Discord

Discord Forum

App Directory execute code on page loading

Unanswered
DollarNavalex posted this in #help-forum
Open in Discord
Hey guys,

I need to execute some code at the page loading (on every pages of my website). This is to load my SQLite plugin of CapacitorJS.
I wanted to put this in _app.js or _document.js but it doesn't exist anymore in the last next.js version. What are the workaround to achieve this now ? Can't really use my layout file cause it can be overidden by a sub-layout file, and my layout is server-side, where my code needs to be client-side, and i can't move my layout to client-side (using metadata)

0 Replies