From 381b0a9a1a2e1f2209027b88b741fe718c4e0089 Mon Sep 17 00:00:00 2001 From: Shreerang Kale Date: Tue, 3 Jun 2025 16:37:01 +0530 Subject: [PATCH 1/5] Setup import-meta-env --- config-overrides.js | 6 +- package.json | 11 +- public/index.html | 3 + src/hooks/useAddAccountEmbed.ts | 2 +- src/hooks/useGetOrCreateAccounts.ts | 2 +- src/import-meta-env.d.ts | 14 ++ src/screens/AddNetwork.tsx | 2 +- src/screens/ApproveTransaction.tsx | 2 +- src/screens/ApproveTransfer.tsx | 2 +- src/screens/AutoSignIn.tsx | 2 +- src/screens/SignRequestEmbed.tsx | 2 +- src/screens/SignTxEmbed.tsx | 2 +- src/screens/WalletEmbed.tsx | 2 +- src/utils/constants.ts | 6 +- .../wallet-connect/WalletConnectUtils.tsx | 2 +- yarn.lock | 219 +++++++++++++++++- 16 files changed, 254 insertions(+), 25 deletions(-) create mode 100644 src/import-meta-env.d.ts diff --git a/config-overrides.js b/config-overrides.js index af26d75..4b7adbe 100644 --- a/config-overrides.js +++ b/config-overrides.js @@ -31,7 +31,11 @@ module.exports = function override(config, env) { config.plugins.push( new webpack.ProvidePlugin({ Buffer: ["buffer", "Buffer"], - }) + }), + require("@import-meta-env/unplugin").webpack({ + example: ".env.example", + env: ".env", + }), ) config.module.rules.push({ diff --git a/package.json b/package.json index 8d8b52d..7799775 100644 --- a/package.json +++ b/package.json @@ -52,6 +52,7 @@ "scripts": { "start": "react-app-rewired start", "build": "react-app-rewired build", + "set-env": "import-meta-env -x .env.example -p build/index.html", "test": "react-app-rewired test", "lint": "eslint .", "prepare": "husky", @@ -77,6 +78,9 @@ }, "devDependencies": { "@babel/plugin-transform-modules-commonjs": "^7.24.8", + "@import-meta-env/cli": "^0.7.3", + "@import-meta-env/typescript": "^0.4.0", + "@import-meta-env/unplugin": "^0.6.2", "@types/json-bigint": "^1.0.4", "@types/lodash": "^4.17.7", "@types/node": "^16.7.13", @@ -85,12 +89,15 @@ "@typescript-eslint/eslint-plugin": "^6.13.2", "@typescript-eslint/parser": "^6.13.2", "crypto-browserify": "^3.12.0", + "dotenv": "^16.5.0", "eslint": "^8.3.0", "eslint-config-react-app": "^7.0.1", "eslint-plugin-react": "^7.33.2", "eslint-webpack-plugin": "^3.1.1", "husky": "^9.0.11", "react-app-rewired": "^2.2.1", - "stream-browserify": "^3.0.0" - } + "stream-browserify": "^3.0.0", + "webpack-cli": "^6.0.1" + }, + "packageManager": "yarn@1.22.19+sha1.4ba7fc5c6e704fce2066ecbfb0b0d8976fe62447" } diff --git a/public/index.html b/public/index.html index f863862..25b8db1 100644 --- a/public/index.html +++ b/public/index.html @@ -28,6 +28,9 @@ Learn how to configure a non-root public URL by running `npm run build`. --> Laconic Wallet +