Improve custom virtual file system and modue loader to allow relative imports
Closed this issue ยท 12 comments
Allow relative imports of source files from virtual file system.
Add documentation for virtual file system usage.
@sebastianwessel - sorry to be a bothersome. Can I get an example of how to use this with a exported function as import in the vfs?
ps; when using this via cdn in browser from esm.sh I am getting this error:
Uncaught TypeError: Failed to resolve module specifier '@jitl/quickjs-ng-wasmfile-release-sync'
Hey @MarketingPip,
Thanks for your interest in this library! I'm happy to help out if I can.
Are you looking to add a file to the virtual file system and then import it into your script? If so, you might find this example useful:
Feel free to reach out if you have any more questions!
...regarding the usage in browser.
It is currently not the highest priority, but I will add some more documentation about it and I also need to investigate a bit more
Issue will be tracked here: #22
@sebastianwessel - you're the best! Was right in front of my eyes!
That said would be VERY cool to see this for usage of browser. (Would be very useful for in browser code editors ๐).
ps; since I have been looking for something exactly like this library for a while for browser - possible suggestion. Add feature for building a HTML document too with support for style sheets etc.... that gets written out with imports / style sheets etc parsed. (Could be useful for serving pages etc from web server too - as well in browser code editors as I said). Which if you're looking to collaborate on anything too - do let me know. Maybe you could implement your library into project I am working on! ๐
Small doc: https://sebastianwessel.github.io/quickjs/usage-in-browser-and-providers.html
browser example: https://github.com/sebastianwessel/quickjs/tree/main/example/browser
Little test: https://sebastianwessel.github.io/quickjs/example.html (chrome only atm)
@sebastianwessel - I see your CSS skills are way better than mine lol!
I got this when running
caught TypeError: Symbol.dispose is not defined.
at pt (quickJS.js:10:40)
at evalCode (quickJS.js:148:43)
I see your CSS skills are way better than mine lol!
๐คซ ChatGPT
Which browser do you use? I've seen this too in Firefox & Safari - but not in Chrome for ๐คทโโ๏ธ reason.
@sebastianwessel older version of chrome running in indigo version.
@sebastianwessel - I found a polyfill that solved this, maybe you want to document it or look into the polyfill itself further etc...
See here
@sebastianwessel - no chance you got to look at that poly fill? (Possibly dynamically import it etc if not found...?) - Worked on my device to solve my issue.
I'm currently focusing on the next version, which, in theory, should not have this issue.
@sebastianwessel - no worries. (Not that I am bugging you for this). Just figured maybe it might be help to you!
Cheers ๐ฅ