[英]How to import in ES6?
How can I translate var exec = require('child_process').exec
; 我该如何翻译
var exec = require('child_process').exec
; to ES6? 到ES6? I know the following:
import exec from 'child_process';
我知道以下内容:
import exec from 'child_process';
What I don't know is how to add the .exec
at the end to the ES6 syntax. 我不知道如何在末尾将
.exec
添加到ES6语法中。
How can I translate var exec = require('child_process').exec;
我该如何翻译var exec = require('child_process')。exec; to ES6?
到ES6?
You do: 你做:
import { exec } from 'child_process';
I know the following: import exec from 'child_process';
我知道以下内容:从'child_process'导入exec;
That's actually wrong, it is as I've done above. 这实际上是错误的,就像我在上面所做的那样。 More on
import
here . 更多关于
import
这里 。
Otherwise, is simply: 否则,就是:
import child_process from 'child_process';
const exec = child_process.exec;
You CANNOT do anything like: 您无法执行以下操作:
import exec from 'child_process'.exec;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.