cmajor-lang / cmajor

The Cmajor public repository
https://cmajor.dev
Other
522 stars 31 forks source link

The HTTP Server should discard query parameters when resources are requested instead of returning resource not found #63

Closed giohappy closed 4 months ago

giohappy commented 4 months ago

Some bundlers use a timestamp hash for modules loaded asynchronously, to force loading fresh code, or for hot reloading. For example with Parcel I get something like this:

http://127.0.0.1:51000/session_2453fd8c9/dist/browserAll.19a78b1f.js?1714856241631

where the 1714856241631 portion after the question mark is a cache busting parameter. Cmajor returns:

The resource '/session_2453fd8c9/dist/browserAll.19a78b1f.js?1714856487233' was not found.

But if I remove the parameter the file is returned as expected. In my opnion, the Cmajor server should discard any request parameter (at least any parameter that is not interpreted by itself) and return the resource as is.

cesaref commented 4 months ago

This does seem sensible, i'll see what can be done

giohappy commented 4 months ago

Thanks @cesaref.

giohappy commented 4 months ago

Actually, the cache busting mechanism should probably be taken into account by the Cmajor server itself in case it does its own caching...

I haven't digged too much inside the code of the server and the PatchManifest mechanisms for reading resources, but if they implement a cache, it should be invalidated if any parameter is set in the path.

Just to share some thoughts.

cesaref commented 4 months ago

There's a fix for this in the latest pre-release (1.0.2496)