Closed advweb-grp1 closed 1 year ago
There is an issue with setting the DEV env variable in that the import will always default to _dev collections because the variable is treated as a string rather than a boolean. This means that the current implementation with constants:
export const collections = { hcm: import.meta.env.VITE_DEV ? 'hcm_dev' : 'hcm', user: import.meta.env.VITE_DEV ? 'users_dev' : 'user' };
Will always use _dev
The solution is to treat the env as a string and match on 'true'. Then export the object at the end of the file like:
const collections = {}; if (import.meta.env.VITE_DEV == 'true'){ collections.hcm = 'hcm_dev'; collections.user = 'users_dev'; }else{ collections.hcm = 'hcm'; collections.user = 'user'; } ... export{ collections, fields };
There is an issue with setting the DEV env variable in that the import will always default to _dev collections because the variable is treated as a string rather than a boolean. This means that the current implementation with constants:
Will always use _dev
Solution
The solution is to treat the env as a string and match on 'true'. Then export the object at the end of the file like: