App.[tj]sx

    The identifier for the entry points when the application uses Self-controlled Routing.

    App.[tj]sx is not the actual entry. Modern.js will generate the real entry for application. The content is roughly as follows:

    import React from 'react';
    import ReactDOM from 'react-dom/client';
    import { createApp, bootstrap } from '@modern-js/runtime';
    // App.[jt]sx
    import App from '@_modern_js_src/App';
    // runtime plugin
    import { router } from '@modern-js/runtime/plugins';
    
    const IS_BROWSER = typeof window !== 'undefined' && window.name !== 'nodejs';
    const MOUNT_ID = 'root';
    
    let AppWrapper = null;
    
    function render() {
      AppWrapper = createApp({
        plugins: [
         router({...{"serverBase":["/"]}, ...App.config?.router}),
        ]
      })(App)
      if (IS_BROWSER) {
        bootstrap(AppWrapper, MOUNT_ID, null, ReactDOM);
      }
      return AppWrapper
    }
    
    AppWrapper = render();
    export default AppWrapper;
    NOTE

    In the multi-entry scenario, each entry can have its own App.[jt]sx. See Entries for details.