processing / processing/p5.js

[2.0] Document workarounds for inter-addon dependencies

Open
#7,798 13 comments 1 reaction 1 assignee View on GitHub

@VANSH3104 is already working on this.

Since May 8, 2025.

Discussion
Dominant language
JavaScript
Stars
24k
Forks
3.8k
Avg merge
3d 16h
Merged PRs (30d)
25

Description

Topic

There are some scenarios right now where you might want to have multiple addons in the same sketch. Sometimes, if those addons depend on each other, then the ordering of your addon script tags can affect whether or not the sketch runs correctly.

I proposed a potential API change in https://github.com/processing/p5.js/issues/7797 to help resolve these issues, but in the mean time, there are some workarounds that we can document.

  • For end users: You can rearrange your script tags to put them in the correct order. There are slightly more involved instructions for doing this in OpenProcessing since you'd have to switch your sketch to HTML mode.
  • For addon developers: @quinton-ashley had a good idea, and that is, bundling all of an addon's dependencies into one file. e.g. if your addon depends on the preload addon existing and running after your addon, then it could make sense to just include the preload code after your code in your bundled js file.

This documentation could live in https://github.com/processing/p5.js/blob/dev-2.0/contributor_docs/creating_libraries.md but also that document needs to be updated for 2.0 as well.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.