入口是依赖关系图的开始,从入口开始寻找依赖,打包构建,webpack允许一个或者多个入口配置:

单入口配置

  1. module.exports = {
  2. // 入口起点
  3. entry: './src/index.js',
  4. }

多入口配置

  1. module.exports = {
  2. entry: {
  3. index: path.join(srcPath, "index.js");
  4. other: path.join(srcPath, "other.js");
  5. }
  6. }