webpack4(二)入口entry和出口output进阶用法

305 阅读1分钟

1. 入口entry

(1)单入口

单文件:

例如: entry:‘./src/index.js’

多文件:

在你想要多个依赖文件一起注入,并且将它们的依赖导向到一个“chunk”时,传入数组的方式就很有用。

例如:


 entry:[‘./src/index.js', ’./src/b.js’],


(2)多入口

例如:


2. 出口output

(1)单出口



(2)多出口

[name] 原文件的名字