TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

ES modules: A cartoon deep-dive

217 pointsby skellertorabout 7 years ago

11 comments

mrspeakerabout 7 years ago
I can&#x27;t wait for ES module support in Firefox by default (so all major browsers are covered). It feels so good to be able to write code in &quot;plain old JavaScript&quot; again without the need for transpilers and build tools for small apps. I made this minecraft WebGL2 thing (<a href="https:&#x2F;&#x2F;mrspeaker.github.io&#x2F;webgl2-voxels&#x2F;" rel="nofollow">https:&#x2F;&#x2F;mrspeaker.github.io&#x2F;webgl2-voxels&#x2F;</a>) all in modules, and being able to just view-source without any shenanigans feels like the old days.<p>The only issue now is I want to share the code with a Node server... I really hope the new proposals will help bridge the require&#x2F;import gap!
评论 #16702704 未加载
评论 #16700621 未加载
评论 #16703854 未加载
评论 #16702654 未加载
plopzabout 7 years ago
The problem I find with the current ES modules is a lot of statements like this<p>import {thing} from &#x27;..&#x2F;..&#x2F;..&#x2F;thing&#x2F;in&#x2F;dir.js&#x27;<p>and then if I move a file I have to change all of its imports to a different number of parent traversals. It would be really nice to be able to define a path that all imports would be relative from.<p>I think babel has something like this using @, but I don&#x27;t use babel right now.
评论 #16702278 未加载
评论 #16702472 未加载
评论 #16702356 未加载
评论 #16703571 未加载
评论 #16716910 未加载
评论 #16702533 未加载
kopiteabout 7 years ago
Good work Lin. You are the hero, JS community needs.
EamonnMRabout 7 years ago
This has been the only thing keeping me using Babel for a couple of years now. Every other ES6 thing I really wanted is in vanilla JS. I&#x27;m pretty thrilled.
ivanfonabout 7 years ago
MDN has the best articles.
tw1010about 7 years ago
This is what we get when we encourage rather than actively discourage new innovative ways to explain things. There are so many academic fields that could reduce their learning curve if they only embraced this idea rather than close off any and all attempts to deviate from the path of established rhetoric (which could cause huge cascades of innovation throughout all industries, making many fields look a lot more similar in their pace of growth to the front end world).
ballenfabout 7 years ago
FWIW, I was wanting to play with native modules locally using files loaded directly in browser instead of a local Node instance.<p>That&#x27;s about impossible in Chrome (in my experience and as per SO answers) and trivially easy in Safari.<p>Develop menu &#x2F; Disable Cross-Origin Restrictions<p>Not that spinning up node is really any slower when you take into account auto-reload capabilities.
jasonkesterabout 7 years ago
It seems like the pendulum of &quot;configuration vs. convention&quot; has swung all the way back to the configuration side.<p>Before: add all the scripts you&#x27;ll need to the HTML. Just don&#x27;t run any scripts before the document loads.<p>Today: bundle in 6mb of dependencies to solve that &quot;problem&quot; so that we don&#x27;t have to use window.onload.<p>I especially like the sibling commment about how this new development gets us closer to the good old days of being able to view source on our code. As though that was something that had happened to them, rather than a conscious decision to adopt worse tools.
incadenzaabout 7 years ago
These Mozilla posts are very well done! As per the article, I&#x27;m always excited to see the JS community converge towards decent standards. This has been a long time coming.
dcwcaabout 7 years ago
Great work by Lin Clark, as usual!
jimmytideyabout 7 years ago
A beautiful explanation.