Skip to content

Commit e55c6de

Browse files
committed
Update MSW React CRUD example dependencies and config
Changed ObjectStackClient baseUrl to empty string in App.tsx for correct API routing. Added test-import.mjs for testing Field import from @objectstack/spec/data. Updated Vite config to pre-bundle additional @objectstack/spec packages for compatibility.
1 parent aa3d31c commit e55c6de

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

examples/msw-react-crud/src/App.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ export function App() {
2626
async function initializeClient() {
2727
try {
2828
// Initialize ObjectStack Client pointing to our mocked API
29+
// Note: We use an empty baseUrl because the Discovery Endpoint is at /api/v1
30+
// and the server routes (returned by connect) already include the /api/v1 prefix.
2931
const stackClient = new ObjectStackClient({
30-
baseUrl: '/api/v1'
32+
baseUrl: ''
3133
});
3234

3335
// Connect to the server (will be intercepted by MSW)

examples/msw-react-crud/vite.config.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ export default defineConfig({
88
port: 3000,
99
},
1010
optimizeDeps: {
11-
include: ['msw', 'msw/browser']
11+
include: [
12+
'msw',
13+
'msw/browser',
14+
'@objectstack/spec/data', // Force pre-bundling for CJS compatibility
15+
'@objectstack/spec/system',
16+
'@objectstack/spec/ui'
17+
]
1218
}
1319
});

0 commit comments

Comments
 (0)