ES6 and Who Imported Me?

I work with a built-in javascript system (I think?) On ES6-compatible javascript, which is compiled / translated to a browser-compatible javascript (Wordpress Calypo, if this is important )

Does modern javascript have the ability to reflect the context of the call? In other words, if I have a javascript foo module

#File: foo/index.js
//...lots of code...
export default () => {
    //...more code...
}

Is there any way to tell at runtime which other javascript module and / or file imported my "foo" module? If this is not possible, is there a general way to do this with static analysis. If my question makes no sense because I made the wrong assumption (the most likely scenario), I would like this assumption to be fixed.

+4
source share
1 answer

tl; dr: No and no.

There is no specific snippet of ES6 JavaScript code to determine how it was downloaded. The best thing you can do is download Javascript to tell the loaded Javascript how the loader has bypassed it.

100% , , , 100% , . ( ).) , 100% - , , . , , , Javascript, , .

+4

Source: https://habr.com/ru/post/1652929/


All Articles