<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Francesco Zaccaria on Medium]]></title>
        <description><![CDATA[Stories by Francesco Zaccaria on Medium]]></description>
        <link>https://medium.com/@zaccariafra?source=rss-c0355a1aa684------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*VcUUZ_4W9p5Xk-M5.jpg</url>
            <title>Stories by Francesco Zaccaria on Medium</title>
            <link>https://medium.com/@zaccariafra?source=rss-c0355a1aa684------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 22:46:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@zaccariafra/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[ES Modules — New browsers are starting to support it]]></title>
            <link>https://medium.com/@zaccariafra/es-modules-new-browsers-are-starting-to-support-it-c9313abfc0ca?source=rss-c0355a1aa684------2</link>
            <guid isPermaLink="false">https://medium.com/p/c9313abfc0ca</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[modules]]></category>
            <category><![CDATA[es6]]></category>
            <dc:creator><![CDATA[Francesco Zaccaria]]></dc:creator>
            <pubDate>Sat, 06 May 2017 12:09:42 GMT</pubDate>
            <atom:updated>2017-05-06T12:09:42.702Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/756/1*BUxAT_JNcgcDFGiTI0UqCg.jpeg" /></figure><p>Before 2015 there wasn’t a native way to work with modules into JavaScript. Developers started to find different ways to implement it: for example splitting the codebase into separated files and scopes, using <a href="https://en.wikipedia.org/wiki/Asynchronous_module_definition">AMD</a> with file loaders like <a href="http://requirejs.org/">RequireJS</a> or just making <a href="https://en.wikipedia.org/wiki/CommonJS">CommonJS</a> work in the browser through <a href="http://browserify.org/">Browserify</a> or other libraries.</p><p>In June 2015 the spec for the <a href="http://www.ecma-international.org/ecma-262/6.0/">6th edition</a> of JavaScript changed things a lot. Finally a native way of working with modules. But it was really hard to implement on the web platform — so module bundlers like <a href="https://webpack.js.org/">Webpack</a> just allowed us to write code and generate a script understandable by the browser.</p><p>But finally modules are starting to be supported into the browsers. Safari 10.1 is the first browser that allows us to use native modules. But also into other browsers it’s possible to use it. Actually are supported in:</p><ul><li>Safari 10.1.</li><li>Chrome Canary 60 — behind the Experimental Web Platform flag in chrome:flags.</li><li>Firefox 54 — behind the dom.moduleScripts.enabled setting in about:config.</li><li>Edge 15 — behind the Experimental JavaScript Features setting in about:flags.</li></ul><p>Just try to create a script element with the type=module</p><pre>&lt;script type=&quot;module&quot;&gt;   <br>  import {addText} from &#39;./test.js&#39;;    <br>  addText(&#39;Lorem Ipsum.&#39;); <br>&lt;/script&gt;</pre><p>And into test.js</p><pre>export function addText(text) {   <br>  const div = document.createElement(&#39;div&#39;);   <br>  div.textContent = text;   <br>  document.body.appendChild(div); <br>}</pre><p>Not all module specifiers are supported yet. A valid module specifiers should be one of this:</p><ul><li>A full non-relative URL. As in, it doesn’t throw an error when put through new URL(moduleSpecifier).</li><li>Starts with /.</li><li>Starts with ./.</li><li>Starts with ../.</li></ul><pre>// Supported: </pre><pre>import {foo} from &#39;https://myamazingwebsite.com/js/main.js&#39;; <br>import {foo} from &#39;/js/main.js&#39;; <br>import {foo} from &#39;./main.js&#39;; <br>import {foo} from &#39;../main.js&#39;;  </pre><pre>// Not supported: </pre><pre>import {foo} from &#39;main.js&#39;; <br>import {foo} from &#39;js/main.js&#39;;</pre><p>ES Modules it’s a really important feature, and to build it, from today, will be much simpler.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c9313abfc0ca" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>