-
Notifications
You must be signed in to change notification settings - Fork 231
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
php-wasm/node : Invalid PHP runtime id #1579
Comments
adamziel
added a commit
that referenced
this issue
Jul 8, 2024
Without this PR, the released `@php-wasm/node` package bundles other `@php-wasm` packages, which caused multiple copies of, e.g. `@php-wasm/universal` to be loaded and resulted in variable identity issues such as #1579. This PR marks all the dependent packages as external and ensures the published package is lean and only contains its own code. ## Testing instructions Run `nx build php-wasm-node` and confirm the resulting `dist/packages/php-wasm/node/index.cjs` files does not contain any external modules
adamziel
added a commit
that referenced
this issue
Jul 8, 2024
Without this PR, the released `@php-wasm/node` package bundles other `@php-wasm` packages, which caused multiple copies of, e.g. `@php-wasm/universal` to be loaded and resulted in variable identity issues such as #1579. This PR marks all the dependent packages as external and ensures the published package is lean and only contains its own code. ## Testing instructions Run `nx build php-wasm-node` and confirm the resulting `dist/packages/php-wasm/node/index.cjs` files does not contain any external modules## Motivation for the change, related issues
Solved in release 0.9.12, thank you for reporting! |
That was quick ! Thanks ! |
Actually, it's only solved when |
You're right. I didn't work with |
adamziel
added a commit
that referenced
this issue
Jul 8, 2024
The `@php-wasm/node` package used to be CommonJS only. This created tricky dependency identity problems in ESM applications, e.g. in #1577 the main script imports the ESM version of `@php-wasm/universal`, but `@php-wasm/node` imports the CJS version of it. This PR ensures `@php-wasm/node` has an ESM version available. This is first step towards solving #1583 Closes #1579 Closes #1577 ## Testing instructions Run `npm run build`, copy the built packages from `dist/packages/php-wasm` to node_modules in another directory, create a test.js script with the following contents: ``` import { PHP } from '@php-wasm/universal'; import { loadNodeRuntime, useHostFilesystem } from '@php-wasm/node'; const php = new PHP(await loadNodeRuntime('8.0')); console.log("Hey"); console.log(await php.run({ code: 'echo "Hello, World!";' })); ``` Then create a package.json file with `{"type":"module"}` and confirm that running test.js works. Then create test.cjs file as follows: ```js const { PHP } = require('@php-wasm/universal'); const { loadNodeRuntime } = require('@php-wasm/node'); async function main() { const runtimeId = await loadNodeRuntime('8.0'); console.log({runtimeId}) const php = new PHP(runtimeId); console.log(php); } main(); ``` And confirm this one works, too.
This works as expected now in version |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
While trying the new version of
@php-wasm/node
, I encountered errors linked with an invalid php runtime ID.Here are the steps I followed :
"type": "module" in
package.json`test.js
and added code :node test.js
The text was updated successfully, but these errors were encountered: