优化export; dev模式增加headers设置

dev
yutent 2023-11-06 19:07:08 +08:00
parent 0a05548c15
commit 24aea78d3d
2 changed files with 13 additions and 1 deletions

View File

@ -186,8 +186,16 @@ export function parseJs(
if (isBuild) { if (isBuild) {
name = name.replace(/\.vue$/, '.js') name = name.replace(/\.vue$/, '.js')
} }
if (alias.trim() === '*') {
return `${t} ${alias} from '${name}'`
}
let _alias = alias
if (alias.includes('* as')) {
_alias = ' default ' + alias.replace('* as', '').trim()
}
return `import ${alias} from '${name}'${ return `import ${alias} from '${name}'${
t === 'export' ? `\nexport ${alias}` : '' t === 'export' ? `\nexport ${_alias}` : ''
}` }`
} }
) )

View File

@ -42,6 +42,10 @@ export default async function createServer(root = '', conf = {}) {
conf.imports['vue-router'] = conf.imports['vue-router-dev'] conf.imports['vue-router'] = conf.imports['vue-router-dev']
} }
if (conf.devServer.headers) {
Object.assign(COMMON_HEADERS, conf.devServer.headers)
}
if (USE_HTTPS) { if (USE_HTTPS) {
Object.assign(SERVER_OPTIONS, conf.devServer.ssl) Object.assign(SERVER_OPTIONS, conf.devServer.ssl)