Skip to content

Commit 5484ca8

Browse files
author
lucifer
committed
feat: 优化环境判断逻辑,使用环境变量区分
1 parent 92a6865 commit 5484ca8

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"lint": "eslint src",
2323
"start": "react-app-rewired start",
2424
"build-web": "PUBLIC_URL=/leetcode-cheat react-app-rewired build",
25-
"build": "react-app-rewired build",
25+
"build": "REACT_APP_BUILD_TARGET=extension react-app-rewired build",
2626
"test": "react-app-rewired test",
2727
"eject": "react-app-rewired eject",
2828
"crawl": "node scripts/curlLeetcode.js && node scripts/generateLeetcode.js",

src/utils.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ export function serialise_bfs(root) {
6565
return ans.slice(0, -1) + "]";
6666
}
6767
export function isInExtension() {
68-
// eslint-disable-next-line
69-
return chrome.storage;
68+
return process.env.REACT_APP_BUILD_TARGET === "extension";
7069
}
7170
export function buildRandomTree({
7271
amount = 10,

0 commit comments

Comments
 (0)