Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build @php-wasm packages as dual ESM + CJS #2087

Merged
merged 1 commit into from
Dec 17, 2024
Merged

Conversation

adamziel
Copy link
Collaborator

@adamziel adamziel commented Dec 16, 2024

Motivation for the change, related issues

Ships CommonJS files alongside ES Modules files for the following packages:

  • @php-wasm/web-service-worker
  • @php-wasm/util
  • @php-wasm/scopes

This resolves Node.js import errors reported in #2086.

Closes #2086

Implementation details

I broke those imports in c6b4f4a by creating a dependency between @wp-playground/blueprints and @php-wasm/web-service-worker. The latter package is only built as ESModules and doesn't ship any commonjs files expected by Node.js.

Testing Instructions (or ideally a Blueprint)

  1. Follow Make it easy to test-publish packages #2053 to test-publish the packages locally
  2. Import @php-wasm/web-service-worker in Node.js to confirm the fix worked

@adamziel adamziel added [Type] Bug An existing feature does not function as intended [Aspect] Node.js labels Dec 16, 2024
@adamziel adamziel changed the title Bundle more packages as CJS Build CommonJS for the remaining ESModule-only @php-wasm packages Dec 16, 2024
@adamziel adamziel changed the title Build CommonJS for the remaining ESModule-only @php-wasm packages Build the ESModule @php-wasm packages as dual ESM + CJS Dec 16, 2024
@adamziel adamziel changed the title Build the ESModule @php-wasm packages as dual ESM + CJS Build @php-wasm packages as dual ESM + CJS Dec 16, 2024
@adamziel adamziel marked this pull request as ready for review December 16, 2024 23:25
@adamziel adamziel merged commit c5d0811 into trunk Dec 17, 2024
9 of 10 checks passed
@adamziel adamziel deleted the publish-more-cjs-packages branch December 17, 2024 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Aspect] Node.js [Type] Bug An existing feature does not function as intended
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Cannot find package @php-wasm/web-service-worker
1 participant