From 24aea78d3dbfb3d29d284b133d333529ab628a03 Mon Sep 17 00:00:00 2001 From: yutent Date: Mon, 6 Nov 2023 19:07:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96export;=20dev=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E5=A2=9E=E5=8A=A0headers=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/compile-vue.js | 10 +++++++++- lib/dev.js | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/compile-vue.js b/lib/compile-vue.js index 299a0f9..c44ab68 100644 --- a/lib/compile-vue.js +++ b/lib/compile-vue.js @@ -186,8 +186,16 @@ export function parseJs( if (isBuild) { 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}'${ - t === 'export' ? `\nexport ${alias}` : '' + t === 'export' ? `\nexport ${_alias}` : '' }` } ) diff --git a/lib/dev.js b/lib/dev.js index b4aa41b..7a27de4 100644 --- a/lib/dev.js +++ b/lib/dev.js @@ -42,6 +42,10 @@ export default async function createServer(root = '', conf = {}) { conf.imports['vue-router'] = conf.imports['vue-router-dev'] } + if (conf.devServer.headers) { + Object.assign(COMMON_HEADERS, conf.devServer.headers) + } + if (USE_HTTPS) { Object.assign(SERVER_OPTIONS, conf.devServer.ssl) -- 2.40.1