FormidableLabs / envy

Node.js Telemetry & Network Viewer
https://envy-webui.vercel.app
MIT License
109 stars 0 forks source link

Is there an enable flag that can be used inside Nextjs config? #203

Open MauricioRobayo opened 9 months ago

MauricioRobayo commented 9 months ago

Something similar to @next/bundle-analyzer enabled flag.

For Nextjs, I imagine it would look something like this:

const envyConfig = {
  serviceName: 'next-app',
  enabled: process.env.ENVY === 'true'
};

Currently I'm doing something like this to avoid my logs to be filled with an infinite stream of envy errors if the webui is not running alongside:

module.exports = process.env.ENVY === 'true'
  ? withEnvy(nextConfig, envyConfig)
  : nextConfig;

and my script to run dev wtih envy looks like this:

"dev": "next dev",
"dev:envy": "npx concurrently \"npx @envyjs/webui\" \"ENVY=true npm run dev\"",

Or is there another recommended approach to this?

Awesome project btw!