webpack浅析

命令行打包:webpack hello.js hello.bundle.js --watch (自动更新) --progress(进度) --display-modules(显示出所有模块) --color

文件内用loader解析:require('style-loader!css-loader!./style.css') css-loader是解析.css文件的引入,命令行形式的:webpack hello.js hello.bundle.js --module-bind 'css=style-loader!css-loader

entry:'字符串',一个入口文件;

  数组:另个不相干的入口文件chunk,打包到一个main trunk;

  对象:多页面应用,key值是chunk name 文件名,

output:{

filename: [name] [hash](打包版本) [chunkhash](各自文件modal的hash,每次打包,变化的文件hash会变,有利于静态资源管理,加载时只需更改改变的文件)

path:

}

html-webpack-plugin: 对模板文件的自动更新引用

context:运行脚本的上下文