Skip to content

[WIP] Refactors to support running in node - #9440

Draft
davepagurek wants to merge 13 commits into
mainfrom
wgpu-refactors
Draft

davepagurek wants to merge 13 commits into
mainfrom
wgpu-refactors

Conversation

@davepagurek

Copy link
Copy Markdown
Contributor

WIP! Trying out some stuff to get a nodejs build to work.

  • Ignoring event handling for now, need to support that somehow later
  • I'm using subpath imports to swap out a platform file for methods that should have separate implementations on node. Just doing the quick thing for now, these APIs probably need more consideration
  • p5.Image is gonna be a big one so I'm just avoiding it
  • It still doesn't actually run yet. But different errors is still progress right???

@p5-bot

p5-bot Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Continuous Release

CDN link

Published Packages

Commit hash: 7c8c8c4

Previous deployments

d6f3351


This is an automated message.

Comment thread src/app.js
Comment on lines +67 to +68
import { _globalInit } from './core/init';
import { waitForDocumentReady } from '#platform';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea for is to use the app.node.js entry point instead of reusing this one. The other entry point simply don't have the global mode stuff. Would that solution work instead?

If some kind of global mode sketch is preferred, I think the experimental new instance mode p5.ni.js probably can fit in for it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that can work, but might not solve the whole problem, because currently the platform-specific calls are scattered kind of everywhere. Having one #platform file to import from works around that. An alternative could be to have app.node.js put an object on the p5 global with those, so that the references everywhere in p5 could grab it from e.g. p5.platform.handleUncaughtErrors?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants