engine icon indicating copy to clipboard operation
engine copied to clipboard

Import URL resolution

Open LeXXik opened this issue 1 year ago • 4 comments

There is some issue with resolving relative paths in module scripts.

Minimum repro app: app.zip

npm install
node app.mjs
localhost:3000/printer/

image

LeXXik avatar May 28 '24 10:05 LeXXik

Thanks for flagging this @LeXXik. So on export the paths in import statements are remapped relative to the root. This obviously won't work if the app is above the root. So we'll need to update so that remapped paths remain relative to the importing module.

marklundin avatar May 28 '24 10:05 marklundin

Any progress on this one? @marklundin

yohami avatar May 29 '24 15:05 yohami

We have a patch for this on both the engine and editor side. I'll let you know as soon as it's out

marklundin avatar May 29 '24 15:05 marklundin

Awesome

yohami avatar May 29 '24 16:05 yohami

This has been fixed and deployed now

marklundin avatar Jun 05 '24 14:06 marklundin

Thanks, I just made a build and the root issue seems to be resolved, there's a new error now

https://nowwa.io/toy/65c1daec34d8b9198d1fc77b/Web/

image

Script seems to be unrecognized at the time of import

image

@LeXXik will probably chime in

yohami avatar Jun 05 '24 14:06 yohami

Update, it's happening on the IDE as well

yohami avatar Jun 05 '24 14:06 yohami

Ignore it, this was on our side :-)

yohami avatar Jun 05 '24 14:06 yohami

Yep Script was reverted in https://github.com/playcanvas/engine/pull/6355, so use ScriptType for now. It will replaced with a new Script class when this lands

marklundin avatar Jun 05 '24 14:06 marklundin

Yep it works now, thanks a lot!

yohami avatar Jun 05 '24 14:06 yohami