mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-04-16 16:30:26 -05:00
fix: fix injectImports when there's no pre-existing import declarations
closes #2925
This commit is contained in:
@@ -25,7 +25,9 @@ module.exports = function injectImportsAndOptions (source, imports, injections)
|
||||
}
|
||||
})
|
||||
// avoid blank line after the previous import
|
||||
delete ast.program.body[lastImportIndex].loc
|
||||
if (lastImportIndex !== -1) {
|
||||
delete ast.program.body[lastImportIndex].loc
|
||||
}
|
||||
|
||||
const nonDuplicates = i => {
|
||||
return !importDeclarations.some(node => {
|
||||
|
||||
Reference in New Issue
Block a user