Hacker News new | past | comments | ask | show | jobs | submit login

Js has no import system. Bundlers do, and they are terrible at it though.

Which don't work in the browser, the main place we use JS.

It does work in all modern browsers except Edge. Which I grant you might be a sticking point. However, Edge is moving to Chromium in the near future.

Firefox 66:

import('/modules/mon-module.js') SyntaxError: dynamic module import is not implemented

So no network access, and of course no FS access.

Hence, doesn't work in the browser. You need a lib or a bundler.

I'm also using Firefox 66 and it works for me. Here's a live example: https://mdn.github.io/js-examples/modules/basic-modules/

Source code and other examples are at: https://github.com/mdn/js-examples/tree/master/modules

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact