php-wasm icon indicating copy to clipboard operation
php-wasm copied to clipboard

PhpNode and PhpCgiNode locateFile breaks dynamic imports

Open mglaman opened this issue 6 months ago • 5 comments

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];
			}
		};

Screenshot 2024-08-21 at 4 23 28 PM

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.

Screenshot 2024-08-21 at 4 26 24 PM

mglaman avatar Aug 21 '24 21:08 mglaman