<story><title>Fetch API has landed into Node.js</title><url>https://github.com/nodejs/node/commit/6ec225392675c92b102d3caad02ee3a157c9d1b7</url></story><parent_chain><item><author>thyrox</author><text>My biggest issue with node when I was working on it briefly was I couldn&amp;#x27;t do the &amp;#x27;import&amp;#x27; statements like wepback. Are they supported too now?&lt;p&gt;I&amp;#x27;m not a web developer so I had a very hard time understanding why there are so many different type of imports in JavaScript like require, import, umd, amd, etc and which one works in browser and which one works in node?&lt;p&gt;Also why do so many libraries have this strange 5 line header code for this umd, amd, business. Is that to make their packages work with nodejs?&lt;p&gt;Does anyone who knows enough JavaScript point me in the right direction about it. I find all this very confusing.</text></item></parent_chain><comment><author>Cthulhu_</author><text>&amp;gt; I&amp;#x27;m not a web developer so I had a very hard time understanding why there are so many different type of imports in JavaScript like require, import, umd, amd, etc and which one works in browser and which one works in node?&lt;p&gt;If I remember my history correctly, it&amp;#x27;s because when Node first came out, there was no import system in JS, let alone a standardized one; there was no sense of scoping (everything global), nothing about dynamic or lazy loading of dependencies, no tree shaking &amp;#x2F; removing unused code, and even going to the definition of something in an editor was difficult.&lt;p&gt;NodeJS adopted CommonJS (I don&amp;#x27;t recall if they invented it), which is a module and dependency system based on require() and exports. It was only a few years later when the JS standards body settled on import; by then, the JS (dependency &amp;#x2F; module management) world was already very divided.</text></comment>
<story><title>Fetch API has landed into Node.js</title><url>https://github.com/nodejs/node/commit/6ec225392675c92b102d3caad02ee3a157c9d1b7</url></story><parent_chain><item><author>thyrox</author><text>My biggest issue with node when I was working on it briefly was I couldn&amp;#x27;t do the &amp;#x27;import&amp;#x27; statements like wepback. Are they supported too now?&lt;p&gt;I&amp;#x27;m not a web developer so I had a very hard time understanding why there are so many different type of imports in JavaScript like require, import, umd, amd, etc and which one works in browser and which one works in node?&lt;p&gt;Also why do so many libraries have this strange 5 line header code for this umd, amd, business. Is that to make their packages work with nodejs?&lt;p&gt;Does anyone who knows enough JavaScript point me in the right direction about it. I find all this very confusing.</text></item></parent_chain><comment><author>inglor</author><text>Those have been supported for several years now :)&lt;p&gt;You need to tell Node to use the format by either naming your file `.mjs` or setting `&amp;quot;type&amp;quot;: &amp;quot;module&amp;quot;` in your `package.json` file.&lt;p&gt;&amp;gt; Also why do so many libraries have this strange 5 line header code for this umd, amd, business. Is that to make their packages work with nodejs?&lt;p&gt;That&amp;#x27;s just old for &amp;quot;adapt the module system&amp;quot; from the old days and libraries just didn&amp;#x27;t bother updating.&lt;p&gt;I still use amd in my job at Microsoft though for some things so I guess it&amp;#x27;s not useless :)</text></comment>