php-wasm
php-wasm copied to clipboard
PhpNode and PhpCgiNode locateFile breaks dynamic imports
I'm trying out PhpNode and the following:
const php = new PhpNode({
persist: {
mountPath: '/persist',
localPath: process.cwd() + '/tests/fixtures/'
},
sharedLibs: [
await import('php-wasm-zlib'),
await import('php-wasm-libzip')
All is good until the following: See following screenshot
args.locateFile = path => {
let located = userLocateFile(path);
if(located !== undefined)
{
return located;
}
if(urlLibs[path])
{
return urlLibs[path];
}
};
The path
is php8.3-zlib.so
, but urlLibs[path]
has the proper URL. But located
returns a value even though it is wrong.
locateFile
never returns undefined when using PhpNode and returns files which do not exist. See result in the next screenshot.