Skip to content

Commit

Permalink
build: add staging NODE_ENV (Uniswap#4187)
Browse files Browse the repository at this point in the history
* refactor: move initializeAnalytics code to top-level

* expect that there's a node env per key

* remove more dev specific stuff

* module.exports

* remove locales

* fix

* service worker update
  • Loading branch information
vm authored Aug 4, 2022
1 parent 5a9b1e1 commit bd55b1c
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
REACT_APP_INFURA_KEY="4bf032f2d38a4ed6bb975b80d6340847"
REACT_APP_FORTMATIC_KEY="pk_live_357F77728B8EB880"
REACT_APP_LOCALES="locales"
2 changes: 1 addition & 1 deletion babel-plugin-macros.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const isDev = process.env.NODE_ENV !== 'production'
const isDev = process.env.NODE_ENV === 'development'

module.exports = {
styledComponents: {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/i18n.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const plurals: LocalePlural = {
export async function dynamicActivate(locale: SupportedLocale) {
i18n.loadLocaleData(locale, { plurals: () => plurals[locale] })
try {
const catalog = await import(`${process.env.REACT_APP_LOCALES}/${locale}.js`)
const catalog = await import(`locales/${locale}.js`)
// Bundlers will either export it as default or as a named export named default.
i18n.load(locale, catalog.messages || catalog.default.messages)
} catch {}
Expand Down
2 changes: 1 addition & 1 deletion src/serviceWorkerRegistration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function checkValidServiceWorker(swUrl: string, config?: Config) {
}

export function register(config?: Config) {
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
if (['production', 'staging'].includes(process.env.NODE_ENV) && 'serviceWorker' in navigator) {
// The URL constructor is available in all browsers that support SW.
const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href)
if (publicUrl.origin !== window.location.origin) {
Expand Down

0 comments on commit bd55b1c

Please sign in to comment.