Skip to content

import 和 export #42

@wenbingyan

Description

@wenbingyan

首先需要了解es6模块化的起源。

是因为最js是没有模块系统的。
最常用的模块方案有Common.js(服务端,node,同步)和AMD(客户端,requireJS,异同),CMD(客户端,seaJS,同步)

ES6 模块的设计思想是尽量的静态化,使得编译时就能确定模块的依赖关系,以及输入和输出的变量。CommonJS 和 AMD 模块,都只能在运行时确定这些东西。

es模块系统有两个主要功能
export:规定模块的对外接口
import:引入其他模块的功能

参考
阮一峰es6
模块系统的演变

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions