File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ /**
2+ * Main Entry Point
3+ *
4+ * Initializes MSW and renders the CRM application.
5+ */
6+
17import React from 'react' ;
28import ReactDOM from 'react-dom/client' ;
39import App from './App' ;
@@ -8,10 +14,8 @@ import { initClient } from './client';
814
915async function bootstrap ( ) {
1016 // 1. Start MSW Mock Server (Critical: Must be first)
11- if ( process . env . NODE_ENV === 'development' ) {
12- console . log ( '🛑 Bootstrapping Mock Server...' ) ;
13- await startMockServer ( ) ;
14- }
17+ console . log ( '🛑 Bootstrapping Mock Server...' ) ;
18+ await startMockServer ( ) ;
1519
1620 // 2. Initialize Clients (Must happen AFTER MSW is ready)
1721 // This ensures discovery requests (/api/v1/metadata) are intercepted by MSW
Original file line number Diff line number Diff line change @@ -25,6 +25,34 @@ export default defineConfig(({ mode }) => ({
2525 '@object-ui/example-crm' : path . resolve ( __dirname , '../../examples/crm/src' ) ,
2626 } ,
2727 } ,
28+ optimizeDeps : {
29+ include : [
30+ 'msw' ,
31+ 'msw/browser' ,
32+ '@objectstack/spec' ,
33+ '@objectstack/spec/data' ,
34+ '@objectstack/spec/system' ,
35+ '@objectstack/spec/ui'
36+ ]
37+ } ,
38+ build : {
39+ commonjsOptions : {
40+ include : [ / n o d e _ m o d u l e s / , / p a c k a g e s / ] ,
41+ transformMixedEsModules : true
42+ } ,
43+ rollupOptions : {
44+ onwarn ( warning , warn ) {
45+ // Suppress warnings for optional dynamic imports
46+ if (
47+ warning . code === 'UNRESOLVED_IMPORT' &&
48+ warning . message . includes ( '@objectstack/driver-memory' )
49+ ) {
50+ return ;
51+ }
52+ warn ( warning ) ;
53+ }
54+ }
55+ } ,
2856 test : {
2957 globals : true ,
3058 environment : 'jsdom' ,
Original file line number Diff line number Diff line change @@ -9,7 +9,6 @@ import ReactDOM from 'react-dom/client';
99import { App } from './App' ;
1010import { startMockServer } from './mocks/browser' ;
1111
12- // Start MSW before rendering the app
1312async function bootstrap ( ) {
1413 // Initialize Mock Service Worker
1514 await startMockServer ( ) ;
@@ -22,4 +21,7 @@ async function bootstrap() {
2221 ) ;
2322}
2423
25- bootstrap ( ) ;
24+ bootstrap ( ) . catch ( err => {
25+ console . error ( "FATAL: Application failed to start" , err ) ;
26+ document . body . innerHTML = `<div style="color:red; padding: 20px;"><h1>Application Error</h1><pre>${ err . message } </pre></div>` ;
27+ } ) ;
You can’t perform that action at this time.
0 commit comments