gpt4 book ai didi

javascript - 为什么 Angular 2 需要 node.js

转载 作者:行者123 更新时间:2023-11-30 07:13:41 25 4
gpt4 key购买 nike

我没有前端经验,但我想使用 Angular 2 创建一个简单的应用。

为什么我需要先安装 Node.js?为什么 Angular 使用 Node.js?

最佳答案

Angular 使用 Node.js 有几件事:

Angular application developers rely on the npm package manager to install the libraries and packages their apps require. The Angular team recommends the starter-set of packages specified in the dependencies and devDependencies sections.

  • 将使用的 TypeScript 编译成浏览器可以理解的 JavaScript - 浏览器无法原生处理 TypeScript,并且浏览器尚不支持代码中使用的 SystemJS 导入:

We strongly recommend transpiling (AKA compiling) to JavaScript during a build phase before running the application for several reasons including:

We see compiler warnings and errors that are hidden from us in the browser.

Precompilation simplifies the module loading process and it's much easier to diagnose problems when this is a separate, external step.

Precompilation means a faster user experience because the browser doesn't waste time compiling.

We iterate development faster because we only recompile changed files. We notice the difference as soon as the app grows beyond a handful of files.

Precompilation fits into a continuous integration process of build, test, deploy.

关于javascript - 为什么 Angular 2 需要 node.js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38673650/

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