什么是节点 js 中的 import 语句而不是 require

what is a import satement in nodejs instead of require

我正在经历 this module, and found many of the files using the import stament.ex: this one。 谁能告诉我 import 语句是如何替换 nodejs 的 standerd require 语句的,它们是如何工作的?

编辑: 这不是重复的,因为导入语法与 ES6 语法不同

导入语句由 js.io - 存储库正在使用的模块系统提供。

引用项目自述文件:

js.io is a multi-platform package management and module system for JavaScript. js.io modules can be evaluated in a JavaScript runtime (e.g. node.js) or precompiled into a single package for use on the client side.

js.io provides the following:

A module system. Dependency graph that works in the client and the browser. Support and networking libraries that can be used on either platform.

链接示例中的导入语句不符合 ES6 规范。

MDN 开始,ES6 导入的语法遵循以下模式:

import name from "module-name";
import * as name from "module-name";
import { member } from "module-name";
import { member as alias } from "module-name";
import { member1 , member2 } from "module-name";
import { member1 , member2 as alias2 , [...] } from "module-name";
import defaultMember, { member [ , [...] ] } from "module-name";
import defaultMember, * as alias from "module-name";
import defaultMember from "module-name";
import "module-name";

根据上述规则,用法 import AudioManager as exports; 不是有效用法。

我无法从 js.io 的自述文件中推断出确认 ES6 模块是否是该项目的目标。