/**
* 单入口
*/
// 字符串形式
module.exports = {
entry: './file.js'
}
// 数组方式
// 会将数组里的入口文件打包成一个文件
module.exports = {
entry: ['./file1.js', './file2.js', ..., './fileN.js']
}
// 对象形式
module.exports = {
entry: {
main: './file.js'
}
}
/**
* 多入口
*/
module.exports = {
entry: {
main: './file.js',
pageTwo: './page.js',
pageThree: ['./page2.js', 'page3.js']
}
}
/**
* context
*/
module.exports = {
// context: 入口会相对此目录查找
// 若不配置 默认值为当前目录 当前目录等同于package.json所在目录
// context: 如果不通过path.resolve动态配置 watch: true 失效
context: './app'
}