<p dir="auto">It's good to directly run WebAssembly files in <strong>deno</strong> like <code class="notranslate">.js</code> and <code class="notranslate">.ts</code> files. If so then I can run:<br>
<code class="notranslate">deno run myTask.wasm</code><br>
without any additional files and steps. (it exports a common function like <code class="notranslate">main</code> or <code class="notranslate">start</code> or ...)</p>
<p dir="auto">Also it's good to directly import these files to project with simple and readable syntax:<br>
<code class="notranslate">import { task1 } from ".../myLib.wasm"</code></p>
<p dir="auto">Like this code in <a href="https://dev.to/lampewebdev/writing-webassembly-in-rust-and-runing-it-in-deno-144j" rel="nofollow">dev.to</a>, it writes a simple library function called <code class="notranslate">square</code> and import it in <code class="notranslate">.ts</code> file and run that <code class="notranslate">.ts</code> file with deno.</p>
<p dir="auto">Example above can be very simpler:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="const wasmCode = await Deno.readFile(&quot;./target/wasm32-unknown-unknown/debug/wasm_deno_example.wasm&quot;);
const wasmModule = new WebAssembly.Module(wasmCode);
const wasmInstance = new WebAssembly.Instance(wasmModule);
const {
    square,
} = wasmInstance.exports;"><pre class="notranslate"><code class="notranslate">const wasmCode = await Deno.readFile("./target/wasm32-unknown-unknown/debug/wasm_deno_example.wasm");
const wasmModule = new WebAssembly.Module(wasmCode);
const wasmInstance = new WebAssembly.Instance(wasmModule);
const {
    square,
} = wasmInstance.exports;
</code></pre></div>
<p dir="auto">can write somthing like:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import { square } from &quot;./target/wasm32-unknown-unknown/debug/wasm_deno_example.wasm&quot;;"><pre class="notranslate"><code class="notranslate">import { square } from "./target/wasm32-unknown-unknown/debug/wasm_deno_example.wasm";
</code></pre></div>
<p dir="auto">It's much more readable, clean, easy to use, and also do not dirty the global context.</p>
<p dir="auto">This simple feature enables more comfortable journey to publish <strong>libraries</strong> and write cross-platform deno <strong>apps</strong>.</p>
<p dir="auto">It was removed in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="614141502" data-permission-text="Title is private" data-url="https://github.com/denoland/deno/issues/5135" data-hovercard-type="pull_request" data-hovercard-url="/denoland/deno/pull/5135/hovercard" href="https://github.com/denoland/deno/pull/5135">#5135</a><br>
Potentially this should be behind the --unstable flag?</p>
<p dir="auto">cc <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/bartlomieju/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/bartlomieju">@bartlomieju</a></p>