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 -

apache - setting document root in antoher partition on ubuntu -

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