BlueBase
  • 💧Introduction
  • Tutorial
    • 1. Getting Started
      • 1.1 Setup
      • 1.2 Add Plugins
      • 1.3 Create Custom Plugin
    • 2. Backend API
      • 2.1 Create Backend API
      • 2.2 Setup Apollo Client
      • 2.3 Generate Typescript Interfaces
    • 3. Create Screens
      • 3.1 Pending Tasks Screen
      • 3.2 Edit Task Screen
      • 3.3 Task Create Screen
      • 3.4 Tab Navigation
    • 4. CRUD Operations
      • 4.1 Creating Tasks
      • 4.2 Reading Tasks
      • 4.3 Updating Tasks
      • 4.4 Deleting Tasks
    • 5. Enhancements
      • 5.1 Internationalisation
      • 5.2 Theming
      • 5.3 Dynamic Images
      • 5.4 Settings & Configurations
      • User Management
  • Key Concepts
    • 🎡Lifecycle Events
    • â›Šī¸Main App Layout
    • 🔌Plugins
      • Plugin API
      • Register a Plugin
      • Making a Plugin Configurable
      • Developing an Analytics Plugin
      • Developing a Logger Plugin
      • Developing a Theme Plugin
    • 🚇Filters
    • 🎁Components
      • Components API
      • Registering a Component
      • Accessing Components
      • Higher Order Components
    • 🎨Themes
      • Consuming Selected Theme
      • Customise Themes
      • Customise Components
      • Theme Configs
      • Theme Structure
    • đŸŽ›ī¸Configs
  • API
    • 📈Analytics
    • 📔Logger
    • đŸ“ĻBlueBase Modules
    • Registry
  • Guides
    • âœ‚ī¸Code Splitting
    • đŸ‘ŊMigrating to V8
  • Components
    • ActivityIndicator
    • BlueBase
      • BlueBaseApp 📌
      • BlueBaseConsumer 📌
      • BlueBaseFilter 📌
      • ThemeConsumer 📌
    • Button
    • ComponentState 📌
    • EmptyState 📌
    • ErrorState 📌
    • Icons
      • Icon
      • DynamicIcon 📌
      • PluginIcon 📌
    • JsonSchema 📌
    • LoadingState 📌
    • Noop 📌
    • Observers
      • DataObserver 📌
      • ErrorObserver 📌
      • HoverObserver 📌
      • WaitObserver 📌
    • StatefulComponent 📌
    • Typography
    • View
Powered by GitBook
On this page
  • Module Types
  • Dynamic Imports
  • Usage Matrix

Was this helpful?

Export as PDF
  1. API

BlueBase Modules

PreviousLoggerNextRegistry

Last updated 5 years ago

Was this helpful?

One of the main purpose of BlueBase is to have all functionality broken up into separate modules. So that adding or removing any feature may become as simple as press of a button.

Moving forward, from our experience with previous versions, it also became evident that code splitting was a necessity in web environments. And with the latest version, we wanted to support it out of the box.

So, BlueBase has been rewritten from the ground up to replace fixed pieces of code (i.e. functions or React components) to BlueBase Modules.

A BlueBase module is any piece of code that:

  • Maybe a CommonJS module or an ES Module.

  • Maybe the module itself, or a that resolves a module.

Module Types

A challenge we faced in the earlier versions was the different module types in the Javascript ecosystem. We decided back then that BlueBase must support these out of the box.

BlueBase supports both Common JS and ES modules. We do this by checking .default property on the imported modules.

If the .default property does exist, we do module = module.default.

Dynamic Imports

Code splitting is achieved through . All major bundlers (e.g. , ) already support it. An import function in dynamic import specification returns a .

So we check if a module is a , we resolve it automatically, when the module is resolved internally.

Usage Matrix

The table below list where BlueBase Modules are used internally, and their behaviour.

Type

Maybe ES Module

Maybe Promise

Must be resolved at boot?

Plugin

Yes

Yes

Yes

Filter

Yes

Yes

Yes

Routes

Yes

Yes

Yes

Components

Yes

Yes

No

Assets

No

Yes

No

Theme

Yes

Yes

No

Intl

Yes

Yes

No

Filters may have individual listeners as promises too.

đŸ“Ļ
Promise
dynamic imports
Webpack
Parcel
Promise
Promise