why node uses require not import?
问题 I'm learning node.js and am wondering why it uses the require syntax rather than the import syntax which React uses. i.e. const Validator = require("validator"); VS import Validator from "validator"; I believed import is es6 but I don't think that explains why it's not used in node. 回答1: the import and default are newer ES6 features, not yet used by node. Node is actually already implementing the new features as experiment though: with the --experimental-modules flag and only for files saved