Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabling only for vercel production deployments #46

Merged
merged 2 commits into from
Aug 26, 2022
Merged

Conversation

4lejandrito
Copy link
Owner

Using NEXT_PUBLIC_VERCEL_ENV as described in:

https://vercel.com/docs/concepts/projects/environment-variables

@4lejandrito 4lejandrito marked this pull request as draft June 7, 2022 21:21
const { enabled = process.env.NODE_ENV === 'production' } = props
const {
enabled = process.env.NODE_ENV === 'production' &&
(!process.env.NEXT_PUBLIC_VERCEL_ENV ||
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am assuming this !process.env.NEXT_PUBLIC_VERCEL_ENV is just in case someone is deploying it outside of Vercel.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly.

@JamesSingleton
Copy link
Contributor

@4lejandrito have you tried tested this in an actual deployment? It looks good to me.

@4lejandrito
Copy link
Owner Author

@4lejandrito have you tried tested this in an actual deployment? It looks good to me.

I've modified the tests so that they run on vercel and they work like a charm. You can see it for yourself too:

Preview deployment: https://vercel-next-plausible.vercel.app. (No tracking).
Production deployment: https://next-plausible.vercel.app. (Tracking).

I'll publish these changes soon.

Thanks!

@4lejandrito 4lejandrito marked this pull request as ready for review August 26, 2022 05:28
@4lejandrito 4lejandrito merged commit 363420d into master Aug 26, 2022
@4lejandrito 4lejandrito deleted the vercel branch August 26, 2022 05:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants