兼容export xx from yy 语法
parent
27afea8649
commit
ad12433785
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue