javascript - import and call a function with es6 -


this question has answer here:

previously:

var debug = require('debug')('http')   , http = require('http')   , name = 'my app'; 

with es6, how can import , invoke right away first line?

import debug 'debug'(); 

is no no?

you'll need 2 lines:

import debugmodule 'debug'; const debug = debugmodule('http'); 

the import syntax declarative import syntax, not execute functions.


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -