<p dir="auto">Like my title, in the future could Deno use NodeJS module or developer have to rewrite NodeJS module for Deno?</p>
<p dir="auto">We've resisted considering Node compatibility as Deno was under initial development so that those considerations didn't influence the design. But now Deno has a relatively established API and the URL module system is deeply baked in. It is unlikely, at this point, that considering compatibility with existing Node modules will compromise Deno's design goals.</p>
<p dir="auto">It's unlikely we can make Node code work 100% of the time. But we can do a lot to make porting modules over easier. Let's discuss how make Deno work with existing Node code. Here are some ideas:</p>
<ul dir="auto">
<li>
<p dir="auto">One direction could be a transpilation program that takes a CommonJS node file, and translates it into ES modules.</p>
</li>
<li>
<p dir="auto">Node has core APIs like file system and networking which are different (sometimes subtly so) in Deno. For example, <code class="notranslate">require('fs').readFileSync()</code> in Node supports encoding to strings, <code class="notranslate">Deno.readFileSync()</code> does not. I suggest we implement a compatibility layer in deno_std/node to match the semantics. (There has been some effort to do this already in <a href="https://github.com/denolib/node">https://github.com/denolib/node</a>, but progress is slow, I think it makes sense to do it in deno_std.)</p>
</li>
<li>
<p dir="auto">We should attempt a <code class="notranslate">require()</code> implementation. It should probably be in deno_std rather than deno itself. It might make sense to base this on top of dynamic import <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="411031633" data-permission-text="Title is private" data-url="https://github.com/denoland/deno/issues/1789" data-hovercard-type="issue" data-hovercard-url="/denoland/deno/issues/1789/hovercard" href="https://github.com/denoland/deno/issues/1789">#1789</a> (which will land very soon - see <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="456024695" data-permission-text="Title is private" data-url="https://github.com/denoland/deno/issues/2516" data-hovercard-type="pull_request" data-hovercard-url="/denoland/deno/pull/2516/hovercard" href="https://github.com/denoland/deno/pull/2516">#2516</a>).</p>
</li>
</ul>
<p dir="auto">Existing work</p>
<ul dir="auto">
<li><a href="https://github.com/denolib/node-to-deno">https://github.com/denolib/node-to-deno</a></li>
<li><a href="https://github.com/denolib/node">https://github.com/denolib/node</a></li>
</ul>