javascript - What qualifies as being a dynamic export in ES6 -


i hear dynamic exports/imports not allowed in es6.

this website uses example export default 5 * 7; if legal, static export. seems reasonable since evaluates static value of 35, i'm wondering qualifies static export now.

this code uses export default backbone.router.extend({...}); if legal, static, export. seems fishy me seems dynamic export me (exporting result of function call).

the second example exports result of function call, static. function called once, result same on every import.

an example illustrate:

f.js

function f() {     return 2 * math.random(); }  export default f(); // called, before export defined. result: 1.23543 

i1.js

import f 'f';  console.log(f); // 1.23543 

i2.js

import f 'f';  console.log(f); // 1.23543 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -