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
This PR fixes issue #2092 where bundling errors were not visible without using the `--verbose` flag. The fix ensures that when UI extensions or web pixels fail to bundle, the error details are displayed in the command output.
5
+
6
+
## Test Files Provided
7
+
8
+
1.**`test-bundling-error-example.ts`** - A file with intentional syntax and compilation errors
9
+
2.**`manual-test-error-visibility.ts`** - A test script that verifies errors are displayed properly
10
+
11
+
## How to Test
12
+
13
+
### Option 1: Run the Manual Test Script
14
+
15
+
```bash
16
+
cd packages/app
17
+
pnpm tsx manual-test-error-visibility.ts
18
+
```
19
+
20
+
This script will:
21
+
- Try to bundle code with various types of errors
22
+
- Verify that errors are displayed to stderr
23
+
- Check that the error output contains proper error markers and details
24
+
- Test both inline errors and file import errors
25
+
26
+
**Expected output:**
27
+
- You should see detailed error messages displayed
28
+
- The test should report "✅ SUCCESS: Issue #2092 is fixed"
29
+
30
+
### Option 2: Test with Real Extension
31
+
32
+
1. Create a UI extension with an intentional error:
33
+
```bash
34
+
cd packages/app
35
+
# Edit any extension file to include a syntax error, for example:
36
+
# - Remove a closing parenthesis
37
+
# - Import from a non-existent module
38
+
# - Use an undefined variable
39
+
```
40
+
41
+
2. Run the build command:
42
+
```bash
43
+
pnpm shopify app build
44
+
```
45
+
46
+
**Before this fix:** You would see a generic error without details unless using `--verbose`
47
+
**After this fix:** You should see the actual bundling errors with details about what went wrong
48
+
49
+
### Option 3: Run Existing Tests
50
+
51
+
The existing test suite already verifies this behavior:
52
+
```bash
53
+
cd packages/app
54
+
pnpm test src/cli/services/extensions/bundle.test.ts
55
+
```
56
+
57
+
Look for the test: "throws error when bundling fails and displays formatted errors"
58
+
59
+
## What to Verify
60
+
61
+
1. ✅ When bundling fails, error details are shown without needing `--verbose`
62
+
2. ✅ Error output includes `[ERROR]` markers
63
+
3. ✅ Error messages include specific details about what failed (file, line, error type)
64
+
4. ✅ The build process still fails appropriately when errors occur
65
+
5. ✅ The simplified code maintains the same functionality with less complexity
66
+
67
+
## Code Changes Summary
68
+
69
+
The PR simplifies the error handling while maintaining the fix for #2092:
70
+
- Removed unnecessary `ErrorWithErrors` interface
71
+
- Simplified error catching logic in `extension.ts`
72
+
- Kept the essential `onResult` function that writes errors to stderr
0 commit comments