entry
entry 属性支持如下形式:
-
stringentry: './src/app.js'打包结果:
. ├── index.html └── main.e509da2eaba20c6b857e.js -
string[]entry: [ './src/app.js', './src/polyfill.js', ]打包结果:
-
objectentry: { app: './src/app.js', polyfill: './src/polyfill.js', vendor: [ 'lodash', 'axios' ] }对象的值可以是字符串或者字符串数组
打包结果:
. ├── index.html ├── app.57f0c1853de6b01d403f.js ├── polyfill.57f0c1853de6b01d403f.js └── vendor.57f0c1853de6b01d403f.jsentry对象中的每一项都被打包到了一个单独的文件中 -
function-
返回字符串
entry: () => './src/app.js'打包结果:
. ├── index.html └── main.e509da2eaba20c6b857e.js -
返回字符串数组
entry: () => [ './src/app.js', './src/polyfill.js', 'lodash' ]打包结果:
. ├── index.html └── main.1d2fe2315df27e480233.js -
返回对象
entry: () => ({ app: './src/app.js', polyfill: './src/polyfill.js', vendor: [ 'lodash', 'axios' ] })打包结果:
. ├── app.57f0c1853de6b01d403f.js ├── index.html ├── polyfill.57f0c1853de6b01d403f.js └── vendor.57f0c1853de6b01d403f.js
-