fengari-interop icon indicating copy to clipboard operation
fengari-interop copied to clipboard

Import keyword in JS Lua module

Open 0komo opened this issue 3 years ago • 2 comments

Hello, I have noticed some JS package has been used the ESModule instead CommonJS. Its annoying since there's no built-in JS function in lua like js.import.

Does the team have a plan to add import keyword onto JS Lua module?

0komo avatar Aug 01 '22 12:08 0komo

Sure, I think we'd accept a pull request adding a js.import() function that uses a dynamic import

Though note that dynamic import returns a promise, which are not currently handled automatically by fengari (see https://github.com/fengari-lua/fengari-interop/issues/2)

daurnimator avatar Aug 12 '22 10:08 daurnimator

I think this would be EXTREMELY helpful. I might make a PR for this.

AsynchronousAI avatar Jan 29 '24 00:01 AsynchronousAI