Skip to content

[CDX-468] Add modern ESM build#455

Merged
esezen merged 4 commits into
masterfrom
cdx-468-client-js-add-modern-esm-build-issue-452
Jun 15, 2026
Merged

[CDX-468] Add modern ESM build#455
esezen merged 4 commits into
masterfrom
cdx-468-client-js-add-modern-esm-build-issue-452

Conversation

@esezen

@esezen esezen commented May 28, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings May 28, 2026 14:18
@esezen esezen requested a review from a team as a code owner May 28, 2026 14:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds an ESM build output alongside the existing CommonJS + bundled browser build, and wires it into test and release workflows so the project can ship “modern” ESM artifacts (npm module entry + CDN .esm.js).

Changes:

  • Add esbuild-based ESM outputs: lib/esm/constructorio.js (for npm) and dist/esm/*.esm.js (for CDN).
  • Add a dedicated bundled-ESM test path that uses a test-only IIFE artifact for jsdom execution.
  • Update CI/workflows to run bundled ESM tests and publish the ESM bundle to the CDN.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
spec/src/utils/jsdom-global.js Selects the appropriate bundle artifact for bundled tests (legacy vs ESM variant).
spec/src/modules/quizzes.js Updates bundled quiz tests to load the correct artifact for the ESM variant.
scripts/bundle-esm.js New script producing the CDN ESM bundle in dist/esm.
scripts/build-test-iife.js New script producing a test-only IIFE bundle used for bundled ESM tests.
scripts/build-esm.js New script producing the npm ESM entrypoint under lib/esm.
package.json Adds module entry and hooks ESM builds into postcompile/postbundle; adds bundled-ESM test scripts.
.gitignore Ignores dist/test-only/ artifacts.
.github/workflows/run-tests-bundled-esm.yml New workflow running the bundled ESM test suite in CI.
.github/workflows/publish-cdn.yml Publishes the new dist/esm artifact to S3 (versioned + latest).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/bundle-esm.js
Comment thread scripts/build-test-iife.js
Comment thread scripts/build-esm.js
Comment thread package.json
constructor-claude-bedrock[bot]

This comment was marked as outdated.

constructor-claude-bedrock[bot]

This comment was marked as outdated.

@Mudaafi Mudaafi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@esezen A couple of considerations before we merge it in below. Should we also update the readme with instructions on how to utilize the served bundles?

Comment thread package.json Outdated
Comment thread scripts/bundle-esm.js
@@ -0,0 +1,30 @@
const packageJSON = require('../package.json');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should this live in script/s or should it be top-level like the other bundle.js file? Or maybe we should move that one down 🤔

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.

Good catch, I think it makes sense to move the other one down 26d402c

Co-authored-by: Ahmad Mudaafi' <ahmad.mudaafi@constructor.io>
constructor-claude-bedrock[bot]

This comment was marked as outdated.

@constructor-claude-bedrock constructor-claude-bedrock Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This PR adds a modern ESM build output (lib/esm/ and dist/esm/) alongside the existing CJS/IIFE bundles, updates CI to test it, and publishes the ESM bundle to the CDN. The approach is well-structured overall, but there are a few important issues to address.

Inline comments: 7 discussions added

Overall Assessment: ⚠️ Needs Work

Comment thread .github/workflows/run-tests-bundled-esm.yml
Comment thread scripts/build-esm.js
Comment thread scripts/build-esm.js
Comment thread .github/workflows/publish-cdn.yml
Comment thread scripts/build-test-iife.js
Comment thread scripts/bundle-esm.js
Comment thread package.json
@esezen esezen requested a review from Mudaafi June 12, 2026 20:14

@Mudaafi Mudaafi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm, let's merge it on Monday

@esezen esezen merged commit 442f64f into master Jun 15, 2026
19 of 21 checks passed
@esezen esezen deleted the cdx-468-client-js-add-modern-esm-build-issue-452 branch June 15, 2026 14:09
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.

3 participants