#Instrumentation runs twice on built apps

3 messages · Page 1 of 1 (latest)

round relic
#

So for some reason using the instrumentation it runs twice after doing yarn build then yarn start.
It only runs once for yarn dev though
instrumentation.js

export async function register() {
    if (process.env.NEXT_RUNTIME === 'nodejs') {
        console.log('Should only see once');
    }
}
yarn dev:
Should only see once
yarn start:
Should only see once
Should only see once
sweet pilotBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

      🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in <id:customize>

      ✅ You can mark a message as the answer for your post with `Right click -> Apps -> Mark Solution`
      (if you don't see the option, try refreshing Discord with Ctrl + R)
round relic
#

For a maybe unintended work around i found this will work

    if (process.env.NEXT_RUNTIME === 'nodejs' && typeof process.env.__NEXT_PRIVATE_PREBUNDLED_REACT === 'undefined') {