igroot-builder
Version:
白山——zeus系统前端打包工具
34 lines (31 loc) • 835 B
JavaScript
const path = require('path')
const {options: {host, port, homepage}} = require('../bsy')
const {entryDirs} = require('../utils')
module.exports = {
hot: true,
open: true,
inline:true,
quiet: true,
overlay: true,
compress: true,
disableHostCheck: true,
watchContentBase: true,
historyApiFallback: true,
contentBase: path.resolve('src'),
watchOptions: {
ignored: /node_modules/
},
proxy: [
() => ({
target: `http://${host}:${port}/${homepage}.html`,
context: (pathname, req) => pathname === '/' && req.method === 'GET',
logLevel: 'warn'
}),
...entryDirs.map(dir => () => ({
target: `http://${host}:${port}/${dir}.html`,
context: (pathname, req) => pathname === `/${dir}` && req.method === 'GET',
pathRewrite: () => '/',
logLevel: 'warn'
}))
]
}