diff --git a/lib/compile-vue.js b/lib/compile-vue.js index 833bee3..c37f410 100644 --- a/lib/compile-vue.js +++ b/lib/compile-vue.js @@ -157,8 +157,8 @@ export function parseJs( .replace(/\r\n/g, '\n') .replace(/process\.env\.NODE_ENV/g, `'${process.env.NODE_ENV}'`) .replace( - /import ([\w\W]*?) from (["'])(.*?)\2/g, - function (m, alias, q, name) { + /(import|export) ([\w\W]*?) from (["'])(.*?)\3/g, + function (m, t, alias, q, name) { if (name.startsWith('@/')) { name = name.replace('@/', urlJoin(DEPLOY_PATH, ASSETS_DIR)) } @@ -190,7 +190,9 @@ export function parseJs( if (isBuild) { name = name.replace(/\.vue$/, '.js') } - return `import ${alias} from '${name}'` + return `import ${alias} from '${name}'${ + t === 'export' ? `\nexport ${alias}` : '' + }` } ) .replace(/import\((['"])(.*?)\1\)/g, function (m, q, name) {