Skip to content

Slow startup: eager adapt-cli import adds ~6.6s #195

@taylortom

Description

@taylortom

Problem

adapt-authoring-adaptframework eagerly imports adapt-cli at the top of four source files:

  • lib/AdaptFrameworkBuild.js
  • lib/AdaptFrameworkModule.js

Because adapt-cli transitively pulls in bower (~1.7s), inquirer (~2.6s), and download (~1.4s), this adds ~6.6 seconds to every server startup — even though these dependencies are only needed during build/install operations.

Profiling data

Dependency Load time
inquirer 2621ms
bower 1686ms
download 1374ms

Proposed fix

Convert the top-level import AdaptCli from 'adapt-cli' statements to dynamic await import('adapt-cli') at the call sites. This defers the heavy dependency tree until a build or CLI command is actually executed.

Measured improvement: 6602ms → 25ms import time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions