webpack学习笔记 配置配置文件是js文件遵循 CommonJS规范require导入其它文件webpack.config.js配置如下constpathrequire(path);module.exports{mode:development,entry:./foo.js,output:{path:path.resolve(__dirname,dist),filename:foo.bundle.js,},};配置选项有选项名说明mode模式可取值有production,development,none。默认是productionentry入口 指示webpack使用哪个模块作为构建基内部依赖图的开始。其会从入口起点处找出有哪些模块和库是入口起点依赖的output用来告诉webpack在哪里输出它所创建的 bundle以及如何命名这些文件。输出文件默认是./dist/main.js其它生成文件默认位置在./dist文件夹中。属性有path,filenamemodule其下有属性rules数组,数组每个对象元素有两个属性test(用于模式匹配),use(使用插件)plugins指定插件数组