0

I understand the export/import syntax, but what I want to know is how the browser will load these modules.

The transpilers usually just copy the code to the right place, but I'm curious to know how the browser will do this without any transpiler.

Will the import trigger an http request ?

Is the scripts declaration order important ?

koninos
  • 4,969
  • 5
  • 28
  • 47
Mohamed Ramrami
  • 12,026
  • 4
  • 33
  • 49
  • transpilers don't copy code, it's bundlers which "copy" code, transpilers only convert simple ES versions to another ES version – vsync Dec 01 '16 at 09:45
  • 1
    FYI, I've added an answer to the question linked above. Things have moved on since the previous answer. – T.J. Crowder Dec 01 '16 at 10:25
  • actually transpilers compiles the code and convert to another language like Javascript which is understandable by browser. – Tameshwar Feb 12 '17 at 14:38

2 Answers2

-1

Currently browser's do not have capacity to resolve ES6 modules just yet and I don't think there are any real implementations out there at all.

In the future, maybe it will work with HTTP, but we don't know yet because the specification is not yet complete.

SamW
  • 77
  • 1
  • 1
  • 4
-1

Yes, they send a new HTTP request to load the modules.

If you are using any polyfill for module loader, you can check the network activity that module loader send multiple ajax request to load all the modules.

Kishore Kumar
  • 12,675
  • 27
  • 97
  • 154