Skip to content

Lazily load dependencies for running sketches #20

Open
@toolness

Description

@toolness

Right now we sort of do this because the main widget doesn't actually contain p5--rather, the preview frame directly loads it over CDN, and the preview frame isn't created until the sketch starts playing.

However, we also mangle the code via esprima in the widget prior to running it, and that's a fairly big dependency. Possibilities:

  1. Use Webpack code splitting to lazily load esprima and other such dependencies in the widget.
  2. Build a separate Webpack bundle for the preview frame (done in Convert preview-frame.js to TypeScript #21), and move the code-mangling logic into the preview frame.

Another non-mutually-exclusive option is to switch to a different AST parser, such as acorn (not sure how its size compares to esprima, though).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions