Skip to content

Commit

Permalink
fix: Handle NODE_ENV=test while reading path
Browse files Browse the repository at this point in the history
  • Loading branch information
erdkse authored and kambydyne committed Oct 7, 2021
1 parent 42f9186 commit ca9947a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/redux/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ import {PROCESS_ENV, RESOURCES_PATH} from '@utils/env';
*/

export function getStaticResourcePath(resourcePath: string) {
if (PROCESS_ENV.NODE_ENV === 'test') {
return path.join('resources', resourcePath);
}

return PROCESS_ENV.NODE_ENV !== 'development'
? // @ts-ignore
path.join(RESOURCES_PATH, 'resources', resourcePath)
? path.join(RESOURCES_PATH, 'resources', resourcePath)
: path.join('resources', resourcePath);
}

Expand Down
2 changes: 0 additions & 2 deletions src/utils/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,5 @@ function shellEnvSync() {
}
}
}
console.log('process.resourcesPath', process.resourcesPath);
console.log('shellEnvSync', shellEnvSync());
export const PROCESS_ENV: any = shellEnvSync();
export const RESOURCES_PATH = process.resourcesPath;

0 comments on commit ca9947a

Please sign in to comment.