Commit bd55b1cc authored by Vignesh Mohankumar's avatar Vignesh Mohankumar Committed by GitHub

build: add staging NODE_ENV (#4187)

* 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
parent 5a9b1e10
REACT_APP_INFURA_KEY="4bf032f2d38a4ed6bb975b80d6340847"
REACT_APP_FORTMATIC_KEY="pk_live_357F77728B8EB880"
REACT_APP_LOCALES="locales"
const isDev = process.env.NODE_ENV !== 'production'
const isDev = process.env.NODE_ENV === 'development'
module.exports = {
styledComponents: {
......
......@@ -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 {}
......
......@@ -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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment