Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,4 @@ import './webgl/text';
import './core/init';

module.exports = p5;
export default p5;
Comment on lines 106 to +107
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

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

Having both module.exports = p5; and export default p5; in the same file can cause conflicts during the build process. When Babel transpiles ES6 to CommonJS, export default becomes exports.default = p5, which creates a different export structure than module.exports = p5.

The order and interaction between these two statements depends on the Babel configuration and build system. Consider one of these approaches:

  1. Remove module.exports = p5 and rely solely on export default p5, letting Babel handle the CommonJS transformation
  2. Keep only module.exports = p5 and ensure the build system's UMD wrapper properly exposes it for ES6 imports
  3. Verify through build and integration testing that both exports work correctly together in the current Browserify+Babel setup

The PR should include tests or build verification demonstrating that both CommonJS (require('p5')) and ES6 (import p5 from 'p5') imports work correctly with the compiled output.

Suggested change
module.exports = p5;
export default p5;
export default p5;

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

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

The PR checklist indicates that unit tests are not included or updated. Given that this change modifies the module export mechanism (which is critical for library consumers), tests should be added to verify:

  1. The built library can be imported using ES6 syntax (import p5 from 'p5')
  2. The built library can still be imported using CommonJS syntax (const p5 = require('p5'))
  3. Both import methods provide the same p5 object with all expected properties and methods

Consider adding integration tests that actually import the built library (from lib/p5.js) using both module systems to ensure backwards compatibility and that the new ES6 import works as intended.

Copilot uses AI. Check for mistakes.
Loading