Does DroidScript support modules with WASM?

50 views
Skip to first unread message

Mike Stein

unread,
Jan 6, 2026, 4:48:21 AM (11 days ago) Jan 6
to DroidScript
Good Evening,

I'm a novice programmer who recently discovered DroidScript and think it is a great Android IDE! 

I was hoping to create a node.js app that imports the R language that has been converted to a module with wasm whose project is described here:

The webR project was an already very useful project in that users can access most of the power of R using their mobile devices to connect to servers serving webR. However, the online webR project requires users to download R packages each time one uses webR which makes using webR much less efficient that installed R and one must be online to use it. Unfortunately, there are no other efficient R apps for Android; one can run R via installing termux on Android but even that method requires additionally installing a Linux proot-distro on top of Termux. 

However, the webR developers also created a npm version of webR, and thus I was hoping to create a DroidScript node project using the webR npm package so that I could run webR offline and install R packages on my Android device. I am able to install webR in a node project using DroidScript and even "require" the module. Yet, the project crashes whenever the DroidScript project attempts to initialize webR (which I presume is when it tries to utilize the associated wasm code). To ensure the DroidScript project wasn't crashing due to a conflict between the DroidScript app engine running and the webR module/wasm code, I created a DroidScript html project that contained only the exact html code on the webR developers website to create a test REPL and that  also crashed (yet works when served as single file index.html from a desktop server). 

Here is the html code that crashes in DroidScript html project:
```
<html lang="en">
<head>
    <title>WebR Test Console</title>
</head>

<body>
<div>
<pre><code id="out">Loading webR, please wait...</code></pre>
    <input spellcheck="false" autocomplete="off" id="input" type="text">
    <button onclick="globalThis.sendInput()" id="run">Run</button>
    </div>
   
    <script type="module">
      /* Create a webR console using the Console helper class */
      import { Console } from 'https://webr.r-wasm.org/latest/webr.mjs';
      const webRConsole = new Console({
        stdout: line => document.getElementById('out').append(line + '\n'),
        stderr: line => document.getElementById('out').append(line + '\n'),
        prompt: p => document.getElementById('out').append(p),
      });
      webRConsole.run();
     
      /* Write to the webR console using the ``stdin()`` method */
      let input = document.getElementById('input');
      globalThis.sendInput = () => {
        webRConsole.stdin(input.value);
        document.getElementById('out').append(input.value + '\n');
        input.value = "";
      }
     
      /* Send input on Enter key */
      input.addEventListener(
        "keydown",
        (evt) => {if(evt.keyCode === 13) globalThis.sendInput()}
      );
    </script>    
</body>
</html>
```

Thank you and best wishes for a happy new year,
Sincerely,
Mike

Dave

unread,
Jan 6, 2026, 4:59:04 AM (11 days ago) Jan 6
to DroidScript
DroidScript uses the Android system webview, so. It might be a limitation of your WebView version, have you tried to update your webview using Google Play?

Does the test index.html file you talked about work in the Chrome browser for Android?

Are you getting any specific error messages?

fyi: the node version running inside DS cannot install platform specific native libs/binries only pure javascript npm modules are supported.

Mike Stein

unread,
Jan 6, 2026, 7:22:29 PM (11 days ago) Jan 6
to DroidScript
Thanks, @Dave-- I will test out those things and update the post after I have the results.

Sincerely,

Mike :-)

Dave

unread,
Jan 9, 2026, 1:05:15 PM (8 days ago) Jan 9
to DroidScript
I found my Pyodide WASM project you might be interested in - 
Reply all
Reply to author
Forward
0 new messages