RunJS
RunJS copied to clipboard
[Feature Request] Add support for ES Modules
Hi, great work! I really like it :D
It would be great to also have the possibility to import native ES Modules.
I tried with my javascript-helpers
and I got an error.
Thanks
Yep, this will come eventually, it's just dependent on upstream dependencies getting updated to support this.
Would it be reasonable to base RunJS on Deno? Imports, TypeScript etc built in. It would certainly be non-trivial but as wonderful as node is, it has some pretty poor aspects.
Btw, one package that may be of interest for bash users is https://github.com/shelljs/shelljs. It does help to "tame" node!
@backspaces RunJS is Electron based which is where it gets its Node integration from. To move to Deno would require Electron to integrate Deno. There's a discussion here about that: https://github.com/electron/electron/issues/23613
Fascinating, Thanks!
Another option would be to use Tauri instead of electron, though you wouldn't get TS support, and since all JS code technically just makes calls from a webview into the native layer, there might be some performance limitations. Though if you wanted to go really deep into it, it does let you bundle binaries (e.g. Node.js and Deno) and invoke them from the webview.
Any update on this?
@5tormTrooper some updates on this can be found here: https://github.com/electron/electron/issues/21457
ReferenceError: exports is not defined
Is this relevant to the current issue?
When I try
export const some = '123';
@vladyn no that's not related, this is about importing ES Modules.
Oh, OK I see. Bu is it possible to have import and export across my scratch files? On 3 Feb 2022, 17:43 +0200, Luke Haas @.***>, wrote:
@vladyn no that's not related, this is about importing ES Modules. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>
@vladyn no, each tab is a sandboxed playground. You could use the 'Set Working Directory' feature to point RunJS to a directory and import files from there.
I've set the directory and save the file. But why I'm getting this error the moment I write "export"?
@vladyn RunJS treats your code as a script, not a module so export is not supported.
ES modules are now supported. Just enable bundling via the preferences.