gpt4 book ai didi

javascript - 为什么 Angular 2 是用 CommonJs 模块格式而不是 AMD 编写的?

转载 作者:行者123 更新时间:2023-11-30 00:09:15 25 4
gpt4 key购买 nike

<分区>

ADDY OSMANI 所述在他的 article -

AMD adopts a browser-first approach to development, opting for asynchronous behaviour and simplified backwards compatability but it doesn't have any concept of File I/O. It supports objects, functions, constructors, strings, JSON and many other types of modules, running natively in the browser. It's incredibly flexible.

CommonJS on the other hand takes a server-first approach, assuming synchronous behaviour, no global baggage as John Hann would refer to it as and it attempts to cater for the future (on the server). What we mean by this is that because CJS supports unwrapped modules, it can feel a little more close to the ES.next/Harmony specifications, freeing you of the define() wrapper that AMD enforces. CJS modules however only support objects as modules.

因此,Angular 作为客户端 javascript 框架,应该以 AMD 模块格式编写。请帮助我了解我在这里缺少什么。

谢谢!

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com