Skip to content

Conversation

timvandam
Copy link

@timvandam timvandam commented Dec 7, 2024

Some browser-like environments do not support localStorage nor process.env, but can be provided environment variables because they automatically get inlined (i.e. process.env.XYZ gets replaced by whatever value XYZ is during a build step). This change supports this scenario without breaking previous behavior.

As additional context, I am running into issues when trying to use debug in a Shopify POS extension. These extensions run in a sandboxed version of JS that lacks many built-ins like localStorage. Shopify's build step automatically inlines environment variables, but this still failed because process would not be defined, which the previous code required

Some browser-like environments do not support localStorage nor process.env, but can be provided environment variables because they automatically get inlined (i.e. process.env.XYZ gets replaced by whatever value XYZ is during a build step). This change supports this scenario without breaking previous behavior.
Copy link

@Possumkitty Possumkitty left a comment

Choose a reason for hiding this comment

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

Thanks so much this really helped me!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants