Skip to content

Commit 264ff22

Browse files
committed
feat: update appConfig handling for CommonJS/ESM interop and fix manifest loading in mock server
1 parent 4972435 commit 264ff22

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

examples/app-react-crud/src/mocks/browser.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ export async function startMockServer() {
1919

2020
console.log('[MSW] Starting ObjectStack Runtime (Browser Mode)...');
2121

22+
// Handle CommonJS/ESM interop for config loading
23+
const appConfig = (todoConfig as any).default || todoConfig;
24+
2225
const driver = new InMemoryDriver();
2326

2427
// Create kernel with MiniKernel architecture
@@ -31,7 +34,7 @@ export async function startMockServer() {
3134
await kernel.use(new DriverPlugin(driver, 'memory'));
3235

3336
// Load todo app config as a plugin
34-
await kernel.use(new AppPlugin(todoConfig));
37+
await kernel.use(new AppPlugin(appConfig));
3538

3639
// MSW Plugin (intercepts network requests)
3740
await kernel.use(new MSWPlugin({
@@ -132,7 +135,7 @@ export async function startMockServer() {
132135
}
133136

134137
// Initialize default data from manifest if available
135-
const manifest = (todoConfig as any).manifest;
138+
const manifest = appConfig.manifest;
136139
if (manifest && Array.isArray(manifest.data)) {
137140
console.log('[MSW] Loading initial data...');
138141
for (const dataset of manifest.data) {

0 commit comments

Comments
 (0)