Closed joshtynjala closed 2 years ago
Thanks, this is an issue indeed. I've implemented this in 5dedb102b11b83e0309b25ab5ffaa5717b92956e to use the extension of the file we're generating to (eg a node library might want to use ".mjs"
with -js outfile.mjs
).
Thanks!
In web browsers,
import("./com/example/MyClass")
without the file's extension doesn't work. Tested in Safari, Firefox, and Chrome. None of them like it. They expect the file extension, likeimport("./com/example/MyClass.js")
. Interestingly, it seems that bundlers like Webpack can handle the omitted file extension, so maybe theGenes.dynamicImport()
feature was originally tested with an intermediate bundler step, and not directly in a web browser. Or maybe web browsers have gotten more strict over time.Note: Like static imports, I made it skip the .js extension in dynamic
import()
calls whengenes.no-extension
is defined.