@php-wasm/node-* and @php-wasm/web-* packages fail to load in CommonJS environments:
Error [ERR_REQUIRE_ESM]: require() of ES Module .../php_8_5.js not supported.
From what I understood, PR #3062 set the CJS build config to use { 'dynamic-import': false } in build.js. This makes esbuild convert import() to require(), which fails when loading ES modules.
@adamziel was there a reason for disabling Dynamic imports in the CJS build?
CI didn't catch this because the CommonJS test suite tests against outdated npm packages, not the locally built ones.
Steps to recreate the issue
cd packages/playground/test-built-npm-packages/commonjs-and-jest
- update the
@wp-playground/cli package to the latest version
npm test