Webpack学习(一)

来源:互联网 发布:淘宝网民族风服饰 编辑:程序博客网 时间:2024/05/17 21:52

1.资料

webpack官网:http://webpack.github.io/
webpack官方文档:http://webpack.github.io/docs/


2.准备工具

(1)cnpm安装:npm install -g cnpm --registry=https://registry.npm.taobao.org

(2)bower安装:cnpm install -g bower


3.新建并进入文件夹webpack-learn,初始化文件,cnpm init ;bower init

mkdir webpack-learncd webpack-learncnpm initbower init
cnpm init{  "name": "webpack-learn",  "version": "1.0.0",  "description": "learing webpack",  "main": "index.js",  "scripts": {    "test": "echo \"Error: no test specified\" && exit 1"  },  "keywords": [    "webpack"  ],  "author": "charlotte",  "license": "ISC"}Is this ok? (yes) 
bower init{  name: 'webpack-learn',  description: 'learing webpack',  main: 'index.js',  authors: [    'charlotte'  ],  license: 'ISC',  keywords: [    'webpack'  ],  homepage: 'index.html',  private: true,  ignore: [    '**/.*',    'node_modules',    'bower_components',    'test',    'tests'  ]}? Looks good? (Y/n) 

4.创建webpack的配置文件webpack.config.js,目前项目的文件为:

这里写图片描述

原创粉丝点击