# Troubleshooting

# Set the runtime mode to development

In an effort to optimize the development experience, Squide can be bootstrapped in development or production mode. To troubleshoot a persistent issue, make sure that the runtime mode is development:

import { FireflyRuntime, ConsoleLogger, type LogLevel } from "@squide/firefly";

const runtime = new FireflyRuntime({
    mode: "development"
});

# React context values are undefined

If your application utilize remote modules and you are encountering undefined values when providing a React context from the host application and consuming the context in modules, it is likely due to two possible reasons: either you have two instances of React, or you have multiple instances of that React context.

To resolve this issue:

  1. Ensure that the react and react-dom dependencies are shared as singletons between the host application and the remote modules. A React context value cannot be shared between different parts of an application that use different instances of React.

  2. Confirm that the shared React context resides in a library shared as a singleton.

  3. If you are using eager shared dependencies, ensure that ONLY the host application configures these dependencies as eager.

If the issue persists, update your host application and remote module's webpack build configuration with the optimize: false option. Afterward, build the bundles and serve them. Open a web browser, access the DevTools, switch to the Network tab (ensure that JS files are listed), navigate to the application's homepage, and inspect the downloaded bundle files. The problematic React context definition should appear only once; otherwise, you may have multiple instances of the React context.

For additional information on shared dependency versioning, please refer to the add a shared dependency guide.

# Console logs

To faciliate the debugging of a Squide application bootstrapping flow, a lot of information is logged into the console when in development. We recommend using these logs if you suspect that something is wrong with the bootstrapping process of your application.

# Modules registration

# Local modules

  • [squide] Found 4 local modules to register.
  • [squide] 1/4 Registering local module.
  • [squide] 1/4 Local module registration completed.

# Remote modules

  • [squide] Found 1 remote module to register.
  • [squide] 1/1 Loading module "register" of remote "remote1".
  • [squide] 1/1 Registering module "register" of remote "remote1".
  • [squide] 1/1 The registration of the remote "remote1" is completed.

# Deferred registrations

  • [squide] 1/1 Registering the deferred registrations for module "register" of remote "remote1".
  • [squide] 1/1 Registered the deferred registrations for module "register" of remote "remote1".
  • [squide] 3/3 Updating local module deferred registration.
  • [squide] 3/3 Updated local module deferred registration.

# Ready

  • [squide] Modules are ready.

# Routes registration

  • [squide] The following route registration is pending until "managed-routes-placeholder" is registered.
  • [squide] The following route has been registered as a children of the "managed-routes-placeholder" route.
  • [squide] The following route has been registered.

# Navigation items registration

  • [squide] The following static navigation item registration is pending until the "officevibe" section of the "root" menu is registered
  • [squide] The following static navigation item has been registered to the "/federated-tabs" menu for a total of 2 static items.
  • [squide] The following deferred navigation item has been registered to the "root" menu for a total of 4 deferred items.

# Mock Service Worker registration

  • [squide] The following MSW request handlers has been registered: [...]
  • [squide] MSW is ready.

# AppRouter logs

  • [squide] AppRouter state updated: {...}
  • [squide] The following action has been dispatched to the AppRouter reducer: {...}

# i18n logs

  • [squide] Registered a new i18next instance with key "shell": {...}
  • [squide] The language has been changed to "fr-CA".
  • [squide] Detected "fr-CA" as user language.

# env-vars registration

  • [squide] The following environment variables has been registered: {...}

# Module federation logs

  • [squide] Module Federation shared scope is available: {...}