Skip to content

fix of open error and new version 1.0.1#1

Merged
oddball merged 1 commit intomasterfrom
openfix
Mar 12, 2026
Merged

fix of open error and new version 1.0.1#1
oddball merged 1 commit intomasterfrom
openfix

Conversation

@karrmagadgeteer2
Copy link
Copy Markdown
Collaborator

@karrmagadgeteer2 karrmagadgeteer2 commented Mar 10, 2026

Summary: Fix open dependency ESM/CommonJS compatibility

Problem
The open package (used for opening HTML reports/plots in the browser) switched to pure ESM in v9. When @captor/openseries-ts was used in a CommonJS app (e.g. CaptorAB/nodejs), it caused:

[ERR_REQUIRE_ESM]: require() of ES Module .../node_modules/open/index.js not supported

Solution
Dynamic import — Replaced static import open from "open" with (await import("open")).default so open is loaded only when needed and via dynamic import, which works from both ESM and CommonJS.

Pinned version — Set "open": "^8.4.0" to stay on the last CJS-compatible line (v8.x) and keep compatibility with consumers who pin open at 8.4.0.

Changes
package.json — open updated from ^8.0.0 to ^8.4.0.
src/plot.ts — Dynamic import for the plotSeries auto-open behavior.
src/sharpeplot.ts — Dynamic import for the sharpeplot auto-open behavior.
scripts/report.ts — Dynamic import for the report CLI auto-open behavior.
Tests, lint, typecheck, and build all pass. The package should work in both ESM and CommonJS setups without the previous ESM error.

@oddball oddball merged commit 5fc7512 into master Mar 12, 2026
4 checks passed
@oddball oddball deleted the openfix branch March 12, 2026 16:34
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