Since no browser that I know currently implements the ES6 module interface, but transpilers do - I tested babel with this simple example
import { getUsefulContents } from "file.js"; getUsefulContents("http://www.example.com", data => { doSomethingUseful(data); });
I just wanted to see how this translates these lines. To my surprise, he produced the following result:
"use strict"; var _fileJs = require("file.js"); (0, _fileJs.getUsefulContents)("http://www.example.com", function (data) { doSomethingUseful(data); });
The last line seems mysterious to me - especially the (0, _fileJs.getUsefulContents) , what happens there? What is the purpose of this (0, ...) on this line?
source share