您现在的位置:首页 >> 前端 >> 内容

angular装饰器与Webpack安装及使用教程

时间:2018/6/26 15:38:35 点击:

  核心提示:1、安装webpack,要在你自己的项目工程目录下,(在cmd环境下)执行以下命令:结果会产生一个node_modules文件夹,下面有N多目录和文件。(npm init)初始化项目后,当前目录下,会...

1、安装webpack,要在你自己的项目工程目录下,(在cmd环境下)执行以下命令:

 结果会产生一个node_modules文件夹,下面有N多目录和文件。

(npm init)初始化项目后,当前目录下,会生成package.json配置文件。

npm install webpack --save-dev        

...

npm install 

2、webpack打包

在webpack.config.js输出对象中的devServer属性中写配置 

写在package.json中,写在node 命令对应的脚本中,例如我们可以写成:

"scripts": {

"start": "node_modules/.bin/webpack-dev-server    。。。。 "

}

文件tsconfig.json中 :

“experimentaldesorators”:true

3个配置文件

乱!

2、安装一个cli

D:\Program Files (x86)\WebFrontEnd\ng_cli>npm  install --global @angular/cli@latest

C:\Users\OldEric\AppData\Roaming\npm\ng -> C:\Users\OldEric\AppData\Roaming\npm\

node_modules\@angular\cli\bin\ng

> @angular/cli@6.0.8 postinstall C:\Users\OldEric\AppData\Roaming\npm\node_modul

es\@angular\cli

> node ./bin/ng-update-message.js

npm WARN rollback Rolling back node-pre-gyp@0.10.0 failed (this is probably harm

less): EPERM: operation not permitted, lstat 'C:\Users\OldEric\AppData\Roaming\n

pm\node_modules\@angular\cli\node_modules\fsevents\node_modules'

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\@an

gular\cli\node_modules\fsevents):

npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@

1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}

)

+ @angular/cli@6.0.8

updated 1 package in 23.182s

Angular cli帮你干了以下这么多事情:

创建 helloKeriy 目录

应用程序相关的源文件和目录将会被创建

应用程序的所有依赖 (package.json中配置的依赖项) 将会被自动安装

自动配置项目中的 TypeScript 开发环境

自动配置 Karma 单元测试环境

自动配置 Protractor (end-to-end) 测试环境

创建 environment 相关的文件并初始化为默认的设置

3、安装git。

安装后,记得要配置名字和邮箱。

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"

  git config --global user.name "Your Name"

to set your account's default identity.

Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'OldEric@OldEric-PC.(none)')

E:\WebstormProjects\AngularProj>git config --global user.name "olderic"

E:\WebstormProjects\AngularProj>git config --global user.email "491391366@qq.com

"

Tags:AN NG GU UL 
作者:网络 来源:Golden_sof