Simpler way to read a file relative to current module?
So I wrote a little helper function for reading the text content of a file relative to the current module. I came up with the following, but is there any simpler way that I'm missing? It seems a bit wordy 😄
9 Replies
new URL(filepath, import.meta.utl)
?
This is usually what I do for relative wasm URL'sAh, thanks a lot 🙂
Np
even simpler:
import.meta.resolve(filename)
since when is that a thing!?!?!?
That's a good one, but I think it will only resolve modules, not any file
Apparently it resolves to a URL that is potentially a module
It resolves any URL and take into account the import_map.
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View