# Webpack Instrumentation Module Resolution Fix - Evidence

## Problem
Dev server failed to start with webpack error:
```
Attempted import error: 'resolveDataDir' is not exported from '../dataPaths'
[FATAL] Failed to start Next custom server: TypeError: An error occurred while loading instrumentation hook: 
(0 , _lib_dataPaths__WEBPACK_IMPORTED_MODULE_2__.resolveDataDir) is not a function
```

## Root Cause
There were TWO files in src/lib/:
- dataPaths.ts (source file with correct ES module exports)
- dataPaths.js (compiled CommonJS file)

Webpack was resolving to dataPaths.js during instrumentation bundling, but the module exports were not being recognized correctly, causing the "is not exported" error.

## Solution
Deleted the stale dataPaths.js file, forcing webpack to use the TypeScript source file directly with proper transpilation.

## Verification

### Test 1: Dev server startup (PORT=3000)
```bash
cd /home/openclaw/OmniRoute
rm -rf .next
PORT=3000 npm run dev
```

**Result:**
```
[CREDENTIALS] No external credentials file found, using defaults.
[DB] SQLite database ready: /home/openclaw/.config/omniroute/storage.sqlite
[STARTUP] Global fetch proxy patch initialized
[STARTUP] Spend batch writer started
[STARTUP] Guardrail registry initialized
[STARTUP] Builtin skill handlers registered
[STARTUP] Quota cache background refresh started
[STARTUP] Provider limits sync scheduler started
[STARTUP] Cloud/model sync background bootstrap initialized
[STARTUP] Runtime settings hydrated: payloadRules, modelAliases, backgroundDegradation, cliCompatProviders, cacheControl, usageTracking, healthCheckLogs, thoughtSignature, modelsDevSync
[STARTUP] Model alias seed: applied=0, skipped=6, failed=0
[COMPLIANCE] Audit log table initialized
```

✓ No webpack errors
✓ All instrumentation hooks loaded successfully
✓ Server responds with HTTP 200

### Test 2: Webpack error check
```bash
grep -i "is not exported\|Failed to start Next custom server" /tmp/dev-test.log
```

**Result:** No matches found (✓ No webpack errors)

### Test 3: Server accessibility
```bash
curl -s -o /dev/null -w "HTTP %{http_code}\n" http://localhost:3000
```

**Result:** HTTP 200 (✓ Server accessible)

## Files Modified
1. src/lib/dataPaths.js - DELETED (stale compiled file)
2. open-sse/config/credentialLoader.ts - Added fallback for dataPaths import (defensive)

## Conclusion
✓ Dev server starts without webpack errors
✓ No "is not exported from '../dataPaths'" errors
✓ resolveDataDir, getLegacyDotDataDir, isSamePath functions resolve correctly
✓ All instrumentation hooks load successfully
✓ Server accessible and functional

Date: 2026-04-20T15:02:58Z
