webpack 完全教程-03-快速上手

@GuoYongfeng 2016-07-24 13:50:38发表于 iuap-design/blog

快速上手

$ mkdir webpack-demos 
$ cd webpack-demos
$ touch .gitignore README.md 
$ npm init
$ touch entry.js index.html 

entry.js

document.write("一起轻松学习webpack.");

index.html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Webpack 完全教程</title>
</head>
<body>
  <script src="./bundle.js"></script>
</body>
</html>

安装和编译

$ npm install webpack -g
$ webpack entry.js bundle.js

编译信息

Hash: 07146fa86952be132cbc
Version: webpack 1.13.1
Time: 63ms
    Asset     Size  Chunks             Chunk Names
bundle.js  1.42 kB       0  [emitted]  main
   [0] ./entry.js 35 bytes {0} [built]