You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: apps/extension/README.md
+22-58Lines changed: 22 additions & 58 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,12 +6,9 @@
6
6
7
7
Before running the extension, you need to get the environment variables from 1password in order to get full functionality. Run the command `bun extension env:local:download` to copy them to your root folder.
8
8
9
-
### Build Systems
9
+
### Build System
10
10
11
-
The extension supports two build systems during the migration from Webpack to WXT:
12
-
13
-
-**WXT** (new) - Preferred for local development. Opens browser automatically.
14
-
-**Webpack** (legacy) - Still used for production builds during the transition.
11
+
The extension is built with **WXT** (Vite-based) for both local development and production. The dev server opens a browser automatically.
15
12
16
13
### Running the extension locally
17
14
@@ -23,7 +20,7 @@ bun install
23
20
24
21
---
25
22
26
-
#### Option 1: WXT (recommended)
23
+
#### Running with WXT
27
24
28
25
```bash
29
26
bun extension dev
@@ -73,70 +70,37 @@ Absolute output directories by platform:
73
70
- Linux: `/var/tmp/stretch`
74
71
- Windows: `C:/ProgramData/stretch`
75
72
76
-
### Reusing an already-onboarded extension state
77
-
78
-
Use a persistent Chrome user-data directory for the extension browser profile.
73
+
##### Loading into your own Chrome (no managed browser)
79
74
80
-
For absolute mode, set `WXT_CHROME_USER_DATA_DIR` to a stable path and keep reusing it:
75
+
`start:absolute` auto-launches a separate web-ext-managed Chrome with its own
76
+
profile, so it onboards fresh on every run. To instead build/watch to the
77
+
absolute path and load it into your everyday Chrome — keeping your login and
78
+
completed onboarding, the way the old `start:webpack:absolute` worked:
81
79
82
80
```bash
83
-
WXT_CHROME_USER_DATA_DIR=/var/tmp/uniswap-extension-chrome-data bun extension start:absolute
81
+
bun extension start:absolute:no-browser
84
82
```
85
83
86
-
To avoid onboarding on every run:
87
-
1. Start with a stable `WXT_CHROME_USER_DATA_DIR`.
88
-
2. Complete onboarding once.
89
-
3. Reuse the same directory on subsequent runs (or copy it from a known onboarded machine).
84
+
Then load the output directory (e.g. `/Users/Shared/stretch`on Mac) once via
85
+
`chrome://extensions` → **Load unpacked**. Because it lives in your own profile,
86
+
state persists across reruns and you only onboard once. The dev server still
87
+
hot-reloads the unpacked extension.
90
88
91
-
This preserves extension local storage and persisted Redux state, including onboarding status.
89
+
### Reusing an already-onboarded extension state (managed browser)
92
90
93
-
To keep extension dev running without WXT auto-opening a browser window, set:
91
+
`start:absolute` persists its Chrome profile by default — the profile lives in a
92
+
sibling directory of the output dir (e.g. `/Users/Shared/stretch-chrome-data` on
93
+
Mac), so it survives the outdir wipe WXT performs on each build. Complete
94
+
onboarding once and it's preserved (local storage + persisted Redux state) across
95
+
reruns.
94
96
95
-
```bash
96
-
WXT_NO_OPEN_BROWSER=true bun extension start:absolute
97
-
```
98
-
99
-
---
100
-
101
-
#### Option 2: Webpack (legacy)
97
+
To point at a different profile directory, set `WXT_CHROME_USER_DATA_DIR` to any
98
+
stable path **outside** the output dir:
102
99
103
100
```bash
104
-
bun extension start:webpack
105
-
```
106
-
107
-
Then manually load the extension into Chrome:
108
-
109
-
1. Go to **chrome://extensions**
110
-
2. At the top right, turn on **Developer mode**
111
-
3. Click **Load unpacked**
112
-
4. Find and select the extension folder (`apps/extension/dev`)
113
-
114
-
##### Running Webpack with absolute paths (for Scantastic testing)
115
-
116
-
Our Scantastic API requires a consistent origin header, so the build must be loaded from an absolute path. Chrome generates a consistent extension ID based on the path it was loaded from.
117
-
118
-
```bash
119
-
# Mac
120
-
bun extension start:webpack:absolute
121
-
122
-
# Windows
123
-
bun extension start:webpack:absolute:windows
101
+
WXT_CHROME_USER_DATA_DIR=/var/tmp/uniswap-extension-chrome-data bun extension start:absolute
124
102
```
125
103
126
-
Then manually load the extension into Chrome:
127
-
128
-
1. Go to **chrome://extensions**
129
-
2. At the top right, turn on **Developer mode**
130
-
3. Click **Load unpacked**
131
-
4. Find and select the extension folder with an absolute path:
The backend allows these origins, and the ID is consistently generated based on the absolute path.
139
-
140
104
## Migrations
141
105
142
106
We use `redux-persist` to persist the Redux state between user sessions. Most of this state is shared between the mobile app and the extension. Please review the [Wallet Migrations README](../../packages/wallet/src/state//README.md) for details on how to write migrations when you add or remove anything from the Redux state structure.
0 commit comments